#help-development
1 messages ยท Page 1439 of 1
would this code work: ```java
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitScheduler;
public class Main extends JavaPlugin {
private Main plugin;
@Override
public void onEnable() {
}
public void onDisable() {
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(label.equalsIgnoreCase("TNTSpawn")) {
if(sender instanceof Player) {
Player player = (Player) sender;
Location loc = player.getLocation();
World world = player.getWorld();
BukkitScheduler timer = player.getServer().getScheduler();
timer.scheduleSyncRepeatingTask(plugin, new Runnable() {
@Override
public void run() {
world.spawnEntity(loc, EntityType.PRIMED_TNT);
}}, 0L, 100L);
return true;
}
else {
sender.sendMessage("Nope!");
return true;
}
}
return false;
}
}
i'm sure that'll help yeah
don't compare the label
the label may be anything
compare the command name
you are also never cancelling the repeating task so it'll be spawning tnt forever
how should I compare command name?
cmd.getName().equalsIgnoreCase
where should I put that?
and look at my fps
ideally assign a specific command executor to the command
@eternal oxide can you increase the volume?
where you want to compare teh name
he only wants to hit this damage once.
yeah
Do you mean its it hitting each entity more than once?
yeah
does it always kill every hit? no survivors?
He just want it to hit it once
doesn't the damage method fire a new damage event
which then runs your code
which fires the damage method
which then fires a new event
which then runs your code
Thats what I'm thinking
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitScheduler;
public class Main extends JavaPlugin {
private Main plugin;
@Override
public void onEnable() {
}
public void onDisable() {
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(cmd.getName().equalsIgnoreCase("TNTSpawn")) {
if(sender instanceof Player) {
Player player = (Player) sender;
Location loc = player.getLocation();
World world = player.getWorld();
BukkitScheduler timer = player.getServer().getScheduler();
timer.scheduleSyncRepeatingTask(plugin, new Runnable() {
@Override
public void run() {
world.spawnEntity(loc, EntityType.PRIMED_TNT);
}}, 0L, 100L);
return true;
}
else {
sender.sendMessage("Nope!");
return true;
}
}
return false;
}
}``` like this?
which means he's going ot have to manually set health
Yeah it kills when I delete the event.setDamage(0) part
thast not what I asked
or just prevent recursing his events
what did you mean
as for how to go about that i'm not sure
maybe a set or something
or just a bool might do
do that always die with setDamage(0) in?
thats what I thinking too
nope without setDamage(0)
it insta kills
um
We should run this section only 1 time
set a boolean to true in your listener to prevent recursive calls
but how
it insta kills with the setDamage(0) or without it, or always?
if I delete the setdamage(0) and export it it insta kills the mobs in the radius
well if bool, reset bool and return
nah, reset bool at the end of the handler
you'll be firing multiple new events in the handler
so you need to reset it once the handler is completely done
Now i get a null error because, i think it is because i call plugin.blocks.remove(id); from within the iterator?
i think just letting the event fire normally would be the best recourse
it'd let other plugins do stuff with the spread out damage
true
though you might not want to use the final damage in that case
inter plugin compatibility is hard
However, he may get an event fire on an entity between his damaging
in which case he has to track who he's hitting
at the moment
meaning that any events firing during his event handler are caused by his event handler
https://paste.md-5.net/usimitaviq.java I ended up like this @eternal oxide @wraith rapids
Did I use bool thing true?
tell him the harsh truth m8...
so... you expect us to test it for you?
@NotNull
public static String getLastColors(@NotNull String input) {
Validate.notNull(input, "Cannot get last colors from null text");
String result = "";
int length = input.length();
// Search backwards from the end as it is faster
for (int index = length - 1; index > -1; index--) {
char section = input.charAt(index);
if (section == COLOR_CHAR && index < length - 1) {
// Paper start - Support hex colors
if (index > 11 && input.charAt(index - 12) == COLOR_CHAR && (input.charAt(index - 11) == 'x' || input.charAt(index - 11) == 'X')) {
String color = input.substring(index - 12, index + 2);
if (HEX_COLOR_PATTERN.matcher(color).matches()) {
result = color + result;
break;
}
}
// Paper end
char c = input.charAt(index + 1);
ChatColor color = getByChar(c);
if (color != null) {
result = color.toString() + result;
// Once we find a color or reset we can stop searching
if (color.isColor() || color.equals(RESET)) {
break;
}
}
}
}
return result;
}
@eternal oxide thats worked!!!
Is there anything glaringly obviously wrong with this? It is just that the entities don't get removed?
PacketContainer destroyEntity = new PacketContainer(ENTITY_DESTROY);
destroyEntity.getIntegerArrays().write(0, new int[] { id });
for(Player player : Bukkit.getOnlinePlayers()){
try {
plugin.protocolManager.sendServerPacket(player,destroyEntity);
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
afk for delivery
okey @eternal oxide I will store the normal weapon damage and use it for setdamage
thank you
Does the entity you hit get pushed back?
java.lang.NoClassDefFoundError: org/bukkit/plugin/Plugin
at me.tvhee.tvheeapi.core.plugin.TvheeAPIPluginLoader.<init>(TvheeAPIPluginLoader.java:57)
at me.tvhee.tvheeapi.core.plugin.BungeePluginLoader.onLoad(BungeePluginLoader.java:34)
at net.md_5.bungee.api.plugin.PluginManager.enablePlugin(PluginManager.java:344)
at net.md_5.bungee.api.plugin.PluginManager.loadPlugins(PluginManager.java:250)
at net.md_5.bungee.BungeeCord.start(BungeeCord.java:273)
at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:62)
at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15)
Caused by: java.lang.ClassNotFoundException: org.bukkit.plugin.Plugin
at net.md_5.bungee.api.plugin.PluginClassloader.loadClass0(PluginClassloader.java:97)
at net.md_5.bungee.api.plugin.PluginClassloader.loadClass(PluginClassloader.java:59)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 7 more
I understand bungee can't get bukkit classes, but.... I never use org.bukkit.plugin.Plugin
Line 57: this.api = new TvheeAPICore(universalPluginLoader, pluginManager, messagingChannel, chatFormat, description.getPluginLoader(), plugin); (Whole class https://paste.md-5.net/qosidizaxi.js)
just do it the not retarded way
Hmm what do you mean?
you don't need to do classloader fucknuggetry to have you api support both bungee and bukkit
like I explained last time, have an api class for bukkit users to extend, and an api class for bungee users to extend
have them extend or contain a class that declares the common implementations between those two api classes
and only have things specific to bukkit or specific to bungee in those two classes
I have it, UniversalPluginLoader
No need, just one class for Bukkit, one class for bungee
But it is fully possible to only extend my own class
Yes I do it
you ๐๐ฟ do ๐๐ฟ not ๐๐ฟ need ๐๐ฟ your ๐๐ฟ own ๐๐ฟ plugin ๐๐ฟ loader
But why do I get this error? I never use bukkit's plugin
hi everyone
something clearly does
because you are initializing the other class
How do you stop the milk bucket visual glitch when you cancel the milking event?
can't you just give up and do it the not stupid way
I never done new BukkitPluginLoader()
the issue is that you have no idea what you're doing
which was the same then as it is now
you should get used to it tbh
I will show you the final work if I done it
i don't want to see it
If you don't want to help I have to find out myself
i want you to stop banging your head against the wall
public void cowMilk(PlayerInteractEntityEvent event) {
Player p = event.getPlayer();
Cow cow = (Cow) event.getRightClicked();
if (cow.getCustomName().equals("Bull") && p.getEquipment().getItemInMainHand().getType().equals(Material.BUCKET)) {
event.setCancelled(true);
p.sendMessage(":/");
}
else {
;
}
}```
Check your cast to Cow with intanceof
not every right clicked thing is a Cow; check (instanceof) whether it is a cow before you assume (cast)
kind of like with genders
also we have special events or it tho
declaration: package: org.bukkit.event.player, class: PlayerBucketFillEvent
@onyx shale what are your pronouns
declaration: package: org.bukkit.event.player, class: PlayerBucketEvent
Anyone know why this is happening?
@Override
public void onPacketSending(final PacketEvent event) {
Player player = event.getPlayer();
PacketContainer packetContainer = event.getPacket();
int id = packetContainer.getIntegerArrays().read(0)[0];
if(packetContainer.getMeta("CUSTOM").isPresent()) return;
if(this.plugin.blocks.containsKey(id)) event.setCancelled(true);
}
I am using this packet interceptor to stop the packets
uh
but there is no reason as far as i can tell that the items' id should be in the map
you probably want to restrict dropping the packets only for the fallingsand blocks
Thats a point, i couldn't see a way to get the entity from the packet tho
only the entity id
sure, one sec
@EventHandler
public void onExplosion(EntityExplodeEvent event) {
for (final Block b : event.blockList()) {
Collection<ItemStack> drops = b.getDrops();
if(drops.size() > 0) {
try {
ItemStack item = Iterables.get(drops, 0);
Vector vector = (event.getLocation().toVector().subtract(b.getLocation().toVector())).multiply(-0.4);
vector.setX(vector.getX() * x);
vector.setY(vector.getY() * y);
vector.setZ(vector.getZ() * z);
FallingBlock block = b.getWorld().spawnFallingBlock(b.getLocation(), item.getType().createBlockData());
this.blocks.put(block.getEntityId(), 2);
block.setVelocity(vector);
}catch (IllegalArgumentException e){
}
}
}
x,y,z are set elsewhere. but are irrelevant to this
the reason i get the drops is for blocks like grass where i want dirt and things like dead bushes will not fling a dead bush, instead just error out with the stick
public void cowMilk(PlayerInteractEntityEvent event) {
Player p = event.getPlayer();
Cow cow = (Cow) event.getRightClicked();
if (event.getRightClicked() instanceof Cow && cow.getCustomName().equals("Bull") && p.getEquipment().getItemInMainHand().getType().equals(Material.BUCKET)) {
event.setCancelled(true);
p.sendMessage(":/");
}
else {
;
}
}```
still give fake milky
instanceof after cast ๐คฆ
I have a feeling it must have something to do with the drops
the reason i get the drops is for blocks like grass where i want dirt and things like dead bushes will not fling a dead bush, instead just error out with the stick
right @wraith rapids ?
uh, try printing the map in your packet dropper
can i put these things inside a different method than onEnable() ?
this.getCommand("ignite").setExecutor(new PluginCommandExecutor(this));
?paste
yes, technically yes, but in practice there is almost never any reason to do so
oh okay because i saw it somewhere
for one, you probably want your commands to be assigned to their executors during enable
https://paste.md-5.net/ekiduzuxeq.md
The map is {id:seconds_till_deletion}
uhu
as long as that method gets called if and only if your plugin is enabling, it should be fine
You can see where they start to get deleted
but what if i have more commands and i want to make it faster?
then you just repeat the line
okay
this.getCommand("home").setExecutor(new HomeCommand(this));
this.getCommand("tp").setExecutor(new TpCommand(this));
this.getCommand("msg").setExecutor(new MsgCommand(this));
uh
btw u can color format code like this by typing three backticks and the language thing
i vaguely remember there maybe being a way to get an entity by the entity id
yea thanks
@clear iris
though i think that is nms
yes yes i know
i can use it to debug at least
ok just making sure
for debugging purposes, maybe just iterate over all of the entities in the world and see which entity corresponds to which id
and then print it
yh
ye idk tf im doing wrong
do you get any errors?
nope just a fake milk bucket
hmmm
btw with that code if you right click a cow with nothing in your hand you get a nullpointer exception
@EventHandler
public void cowMilk(PlayerInteractEntityEvent event) {
Player p = event.getPlayer();
if (event.getRightClicked() instanceof Cow) {
Cow cow = (Cow) event.getRightClicked();
if (cow.getCustomName().equals("Bull") && p.getEquipment().getItemInMainHand().getType().equals(Material.BUCKET)) {
event.setCancelled(true);
p.sendMessage(":/");
}
}
else {
;
}
}```
lmfao
yea
any idea to stop the cum buckets visual bug
try updating the player inventory
don't compare enums with equals
shame on u
I added this in my runnable @wraith rapids :
for(Entity entity : Bukkit.getWorld("world").getEntities()){
if(entity.getEntityId() == id){
System.out.println(entity.getType());
}
}
But i just got a few Falling Blocks not anything else
i have a command, wich has 1 to 3 args, but some of the args are like "item" or "location", is there a way to setup alliases of item and location to items and locations? (my first idea was if the arg3 == items || itemss, arg3 = item and then check if the arg3 == item do something
@dusty herald what then
==
use a command framework
same thing ??
or if you want to do it yourself
no
have a String -> Subcommand map
only mtters with strings?
and have multiple Strings point at the same Subcommand
f.e "chests" and "ch" would point at the same subcommand
while "items" would point at a different one
i see
== is always nullsafe so that's a plus 
damn that guy died

debug the packet dropper
Sure...
make it print out the id and type of each entity it drops a packet for
although i'm not sure if the entity still exists since the destroy entity packet has already been sent
no that has nothing to do what you're doing
that is for concatenating several arguments into one argument
hey lads, i'm very confused about something that seems very simple and have always done in the years
if (event.getFrom().getX() != Objects.requireNonNull(event.getTo()).getX() || event.getFrom().getZ() != event.getTo().getZ()) {
Location loc = event.getFrom();
event.getPlayer().teleport(loc.setDirection(event.getTo().getDirection()));
}
it just randomly stopped working and had to cancel out the move event
@Override
public void onPacketSending(final PacketEvent event) {
Player player = event.getPlayer();
PacketContainer packetContainer = event.getPacket();
int id = packetContainer.getIntegerArrays().read(0)[0];
for(Entity entity : Bukkit.getWorld("world").getEntities()){
if(entity.getEntityId() == id){
System.out.println(entity.getType());
}
}
if(packetContainer.getMeta("CUSTOM").isPresent()) return;
if(this.plugin.blocks.containsKey(id)) event.setCancelled(true);
}
getBlockX @quaint mantle
doesn't print anything when there is the explosion
huh? no it just let's some people people move, that is not the problem
Soo stupid @wraith rapids
um, why are you teleporting players to the location?
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
if (event.getFrom().getX() != Objects.requireNonNull(event.getTo()).getX() || event.getFrom().getZ() != event.getTo().getZ()) {
Location loc = event.getFrom();
event.getPlayer().teleport(loc.setDirection(event.getTo().getDirection()));
}
}
}
this is all that it has to do
so it allows the player to move the camera
yet it just randomly stopped working for some of the players
like, it seems to be dropping out the entity destroy packets for merging itemstacks
but not for picking them up
maybe comment out the entire thing and see if that's caused by something else entirely
i don't really have any more ideas as to what it could be
pointless, all you have to do is check x,y,z in from and to, then cancel if they are different. ignore and allow pitch and yaw
no point in teleporting
also, stop using Objects.requireNonNull it literally has no place in that code
Sure, one mo
well yeah that is not the problem though, the if check stopped working it never reaches the inside statement
It works fine without the packet interceptor @wraith rapids
that was just an attempt to see what was going on, I do cancel the event normally
get the entity ids of the dropping items and compare them to the ones that get dropped by the packet listener
I'd be surprised if that test ever fails as you are comparing doubles for x and z
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
if (event.getFrom().getX() != event.getTo().getX() || event.getFrom().getZ() != event.getTo().getZ()) {
if (Main.getModeManager().isStarted()) {
if (Main.getModeManager().isDeathmatch()) {
if (!player.isOp()) {
if (!player.getGameMode().equals(GameMode.SPECTATOR)) {
event.setCancelled(true);
}
}
}
} else {
if (!player.isOp()) {
if (!player.getGameMode().equals(GameMode.SPECTATOR)) {
event.setCancelled(true);
}
}
}
}
}
I bet they'd be different more often than not
this is my normal code
I did debug the other checks, it never gets inside the x and z check
yeah that is the point, and it always worked so that is why I am so confused
let me introduce you to my friend
it is registered, and I have quite a lot of years behind so it's not that I just started with spigot or java
It has to be failing somewhere else as theres no way that test of from and to can fail
actually I switched to a new version of tuinity when that stopped working let me see if I revert back to an older version it works
still wouldn't make sense as I am pretty sure that fork doesn't touch anything relating that
Well, all I can say is that code works just fine under Spigot
Hello !
I'd like to use a sqlite database foy my plugin, does anyone know a good video (or a good forum topic) to learn this please ?
(All i can found is for mysql...)
How do i get the id of the dropping items @wraith rapids
listen to whatever event is fired when shit drops and print it out
kk
Oooh I didn't know there was one on spigot, sorry
Thank you for your time
the only case where that would fail is if the player simply turns around
the move event is fired for rotational movement as well
Thats true. If they are ONLY moving the mouse, it would never fire
but the event would just pass through and process normally, so no need to do anything
how do you switch out one item with another item from a player.
like i want to get the diamond sword from the player's inventory and switch it with a stone sword
how would i do that
player.getInventory().setItem(slot, itemstack)
take it away and then put something else in the slot
yes
Of course you would need to do a few checks, maybe use #getFirst
it doesn't seem like they ever get to the packet listener tbh...
well yeah that is the intended use, as well as allow jumping
well something has to be fucking with the packets sent when itemstacks merge
try merging two items manually on the ground
see if it happens only when there's an explosion going on or if it always happens
needs an itemstack
new ItemStack(Material.UNOBTAINIUM)
ty
try it with stone instead of sand
or wait, do it with something that doesn't cause items to drop from the explosion
like ice
it might be that the client is dropping the sand items for the disappearing fallingsand blocks or something
my method doesn't work at all with ice cause there is no drops, lemme change it back a bit
I think i found the problem
the problem was the code that was using the drops to determine the falling sand
wait no it wasn't
try to use a switch statement I guess. Strange though
dont worry about it but could use switch
alright
Nvm, not strange at all
IntelliJ is right there, it can never be anything but 1,2 or 3. Really clever IDE there (even if I assume that it is just parsing Javac output)
to fix that, use random.nextInt(4) + 1 instead
0123
as such, you get an int that is either 0, 1 or 2, the + 1 does the rest
can somebody help?
no.
..
oh my bad
are you perhaps a block game player
block head
but if the random integer is equal to 4 and it adds 1 to it then there would be a 5
it is not
If the IDE says there is an issue, then you will need to look at it very closely, especially if it is not null related
if i set it to 4 it now says that sword == 4 is always true
Does anyone know if it's possible to alter/change the default minecraft Piglin bartering loot table in bukkit?
Thats because once reached its always true
ok
any cheese ways of making passive mob attack player
This is so confusing to me, i have it working now with no delay to removal
depends, how good are you at working with NMS?
There is no non-NMS way i know of doing that
There may be a way, but if there is I do not know it
Hey how comes .displayName() isn't being used in advancement and death messages?
You mean like the display name of a sword?
Then change it...
I did
@EventHandler
public void onDeath(PlayerDeathEvent event) {
event.setDeathMessage(message);
}
This isnt the real code, but its close (cant be asked to open Intellij rn)
get set
That's deprecated
But I haven't modified it at all
Then modify it lol
No its not
This is Spigot not Paper
Yeah sorry wrong place
np
If I remember correct it doesnโt show the display name
But you can change that with a simple replace
what are u trying todo?
Nothing wrong with that method https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/meta/ItemMeta.html#setLocalizedName(java.lang.String)
using org.spigotmc:spigot:1.16.5-R0.1-SNAPSHOT as maven dependency for my plugin
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project <name hidden>: Compilation failure
[ERROR] Bad service configuration file, or exception thrown while constructing Processor object: javax.annotation.processing.Processor: Provider org.eclipse.sisu.space.SisuIndexAPT6 not found
does b1064c69c444b9447a65ad36b6cff39d9e052263 commit on CraftBukkit fix that?
how can I paste a large schematic without lag through code without fawe
you can't?
smear the paste over a longer time
If that isn't possible you will need to use unsafe operations and such and generally is just a PITA
Is there a dependency with only the bungee chat api?
The one which is included in spigot
It would be the chat module in Bungeecord
Ok how to import?
You could manually install it
as you would import anything else
How do you mean install ?
@chrome beacon since when did u get rich
I got gifted Nitro
Still poor
paying money for things is for virgins
Lol nice
did you get anywhere with it
No, i have stripped the code back
but i think there must be some packet i need to deal with
I don't know how to import only the chat api from bungee
i got this far:
@EventHandler
public void onExplosion(EntityExplodeEvent event) {
final Entity en = event.getEntity();
for (final Block b : event.blockList()) {
double Max = 0.5;
double Min = -0.5;
double x = Math.random() * (Max - Min) + Min;
double y = Math.random() * (Max - Min) + Min;
double z = Math.random() * (Max - Min) + Min;
Vector vector = (event.getLocation().toVector().subtract(b.getLocation().toVector())).multiply(-0.4);
vector.setX(vector.getX() * x);
vector.setY(vector.getY() * y);
vector.setZ(vector.getZ() * z);
FallingBlock block = b.getWorld().spawnFallingBlock(b.getLocation(), b.getBlockData());
block.setDropItem(false);
block.setHurtEntities(false);
this.blocks.put(block.getEntityId(), 2);
block.setVelocity(vector);
}
}
//#######################
@EventHandler
public void onBlockChange(EntityChangeBlockEvent event){
if(this.blocks.containsKey(event.getEntity().getEntityId())){
event.setCancelled(true);
}
}
//#######################
public class BlockLand extends PacketAdapter {
private RealPhysics plugin;
public BlockLand(final Plugin plugin) {
super(plugin, PacketType.Play.Server.ENTITY_DESTROY);
this.plugin = (RealPhysics) plugin;
}
@Override
public void onPacketSending(final PacketEvent event) {
int entityId = event.getPacket().getIntegerArrays().read(0)[0];
if(this.plugin.blocks.containsKey(entityId)){
event.setCancelled(true);
}
}
}
and yet you're trying to write an api for people
he has a point @maiden briar
i'm a pretty pointy guy
Yes but why would you
for testing
i don't remember there being an easy one, but there is a pretty good plugin for debugging packets
The solution is simple @wraith rapids I just work with multiple maven modules
one that is made for this exact purpose
whats that?
<
that's for events but it might have packets too, I don't remember off the top of my head
it does
then that
but it is 1.13
it works fine
ok
it uses like reflection or something idk
how can i get rid of this message when enabling a plugin in the console?
you don't
getLogger().info()
ohno
depends on your console, probably
not like you'd need colors in the console anyway
sending a message to the console sender and using system.out has the same color support
it worked just fine for me last week
although i used it for events and not packets
it just spammed my console with all the packets even though i added specific ones
yeah, i think that the packets may not work
it also spat out an error
try calling remove(key) instead of containsKey(key)
Where?
so onEnable is runned when the plugin is loaded? (just to be sure)
in the packet interceptor
yeah
oki
onEnable is called when the plugin is enabled
onLoad is called when the plugin is loaded
but that is not an if statement argument tho?
!= it to null or something
and what does "loaded " mean? :/
a plugin is loaded first
then it gets enabled
as for what that means is up to the plugin
uhh okay
ok....
All plugins have their classes loaded by the server
After which point all plugins are then enabled
not all classes are loaded at once though
Yeah, when called upon
The primary class obviously, listeners, commands and whatever else is registered/referenced onEnable()
can someone give me some tips on how to actually build from this pull request?
https://github.com/sgtcaze/NametagEdit/pull/584
the main class and the classes directly deferenced by that class
how do i get rid of that orange thing in intellij?
real men don't use tests
it's complaining that your code there isn't covered by any tests
goh
as for how you managed to turn those warnings on despite not knowing what tests are, I have no clue
nor do I know how to turn them off because i don't use tests
xd
You need to checkout their branch with Git. git fetch git@github.com:Fernthedev/NametagEdit.git paper-1_16_5-fix:paper-1_16_5-fix
fixed
Then you can checkout that branch with git checkout paper-1_16_5-fix, compile using whatever build system they use
Which seems to be Maven. So mvn clean package
Or if you don't have the original repository, swap out that first command with just a git clone https://github.com/Fernthedev/NametagEdit.git
is there a way to see what PacketType.Play.Server.ENTITY_DESTROY does
cause it is causing no end of problems
Do you want to know what the packet does or when it's being sent?
Well, as soon as i enable the packet listener it causes these weird ghost item drops
so i wondered why it does this
So, i guess both ๐คฃ
Well, the packet listener shouldn't do anything unless you're actively modifying the packet. That packet will remove the entity with the given EID
his issue is that he's trying to prevent fallingsand blocks from disappearing on the client by dropping the entity destroy packets
but somehow that is also preventing dropped items from despawning or merging properly
just on the client? wot
can I do this with GitHub Desktop?
yeah, the actual server-side entity hits the ground and the block form event or whatever is cancelled
Well, i am trying to make a tnt physics pluin, onse sec
so it poofs
my code is up a bit ^^
but he wants to retain the falling entities on the client for a short period of time
which is why he is dropping the entity destroy packet
and resending one for that eid later
Ah I see what you mean
but somehow this is fucking with dropped item entities
Yeah because it would have dropped an item on the server ;p
but the client doesn't understand that because the sand is still there
he has an eid set consisting only of eids for the fallingsand blocks he wants to retain
no other packets should be getting dropped
Probably. GH Desktop just kind of wraps most of the git commands for you. You just have to clone that guy's fork
Those entities @ the end dont work
No no I get that, NNY. Regardless of whether or not you cancel that removal packet, this is going to happen
Server side: The falling sand entity is removed and an item is dropped
Client side: The falling sand entity is kept on the screen, no item is dropped because the entity is still there
well I have seen plugins that managed to remove the "enabling <pluginname>" on console :/
The vectors aren't done yet, hence the bad look
does cancelling the event drop the corresponding item?
i don't remember it doing that
yeah, he is
@EventHandler
public void onBlockChange(EntityChangeBlockEvent event){
if(this.blocks.containsKey(event.getEntity().getEntityId())){
event.setCancelled(true);
}
}
so the entity just poofs on the serverside, without having dropped an item nor having become a block
Ah I see
but since the destroy packet is cancelled, the fallingsand entity remains on the clientside
however there is a dropped item appearing from somewhere on the clientside as well
on the ground
they can't be picked up and don't merge, so I would assume they are client sided
they also all have a stack size of 1
Some can, but there are some that cannot
I'd imagine that the ones that aren't are just from the explosion itself
The ones that you can actually pickup* are from the explosion
The ones that you cannot pickup are client-sided
yeye ok
the issue is definitely caused by the packets being dropped
To fix those server-sided ones you can just set the explosion yield to 0, but yeah I'm not sure about the client-sided ones
Some weird fuckery with the falling sand entities lol
but we've debugged the issue and we're fairly certain that only fallingsand eids are in the eid set
did you try it with different fallingsand vs physical block types yet
Is there another way to make the falling sand entities persist without packets?
that'd let us see whether the items are being dropped from the falling sand by the client or something
what block you want me to try
because just cancelling the destroy packet seemed easier ๐
๐
evidently fucking not though lmao
idk really
Might save you a bit of hassle if you do those client-sided
You will have some other implications like being unable to damage entities that are hit by it, if you're concerned about that
but if you're going just purely for visual, client-side is the way to go
iirc i forgot the method and saw the spawnFallingBlock under world and was like 'thats a good way'
Yeah, i think as well i was thinking it would be easier than applying it to every player as well
Ah nothing a good ole for-each loop couldn't handle
true
how do you spawn the falling sand client side?
it completely evades me
There's a spawn entity packet for you, iirc. Though there might be one specifically for falling sand
Lemme check the protocol
sure ๐
because PotionEffectType is not a PotionEffect
(very useful website by the way if you haven't used it before, https://wiki.vg/Protocol)
yeah i have seen it
new PotionEffect
Yeah looks like just spawn entity is what you need. It's for non-living entities and vehicles which would include falling sand
Also lets you specify a velocity x, y and z
Take a look at the server's PacketPlayOutSpawnEntity class, see its field structure and go from there
ProtocolManager has a #createPacket() method iirc
ok, thanks
So I was wondering. Do you think hosting providers like BisectHosting have the user's password the same as the user login password?
The reason why I am asking is that my plugin requires an app (VLC Media Player) to be installed and that requires sudo like sudo apt-get to install, and I was wondering if the user could enter the password, make the plugin securely encrypt the password using some strong encryption standard (probably AES-256) and use it for installing the software. The code will obviously be open source so there wouldn't be anything sketchy going on.
Although I could just compile the sources by itself (using gcc), VLC Media Player uses many many dependencies that are a pain to handle. I would have to compile each of those dependencies and fetch the source code and statically link them to my VLC binaries, which would be just a pain to accomplish.
so i think im stuck
Should note: for the entity type ID, you can use EntityType.FALLING_SAND.getTypeId()
If you just want to use ProtocolLib that's fine
?
Falling sand doesn't exist
hehe
was renamed from falling sand to falling block at some point
Deprecated because it's an internal magic value by the way but you're fine to use it in this case
Yeah I'm just so used to sand lol
ok awesome, i wish it was still sand
Will spigot ever bump the version of snakeyaml?
imagine having comments
๐ฅฒ
lmao its called player_burp
implying any of us have ever played on hypixel and know what the shit that is
yea lmao
imagine saying lmao
lmao true
๐
I have no clue how to make this packet:
PacketContainer sandPacket = new PacketContainer(SPAWN_ENTITY);
sandPacket.getIntegers().
write(0, 500).
write(1, (int) EntityType.FALLING_BLOCK.getTypeId()).
write(2, (int) (event.getLocation().getX())).
write(3, (int) (event.getLocation().getY())).
write(4, (int) (event.getLocation().getZ()));
Not like this though:
How would i change this to make a custom falling block entity?
:/
If AnvilInventory#setMaximumRepairCost and setRepairCost are used, could I technically set the cost as high as I want (within the limits of an integer ofc)? Or will it reach a stage where it displays "Too expensive!"?
setMaximumRepairCost() unfortunately doesn't update the client afaik so it may still show "Too expensive", though it would be useable
If that were the case I would have done that in implementation 
It's out of our control. Client has a hard-set cap
jeff you're missing a few other required fields. The missing entity data watcher is probably what's calling that NPE
๐ฆ
ah ok
https://gist.github.com/aadnk/4286005 this is a decent example from the (original) ProtocolLib author
It's a very, very old gist, but it's still accurate afaik
okeee
Here I'm again :))))) Is there a way to lock a container inside mc and make it only accessible for the owner?
I mean, yeah probably
listen for the opening
declaration: package: org.bukkit.event.inventory, class: InventoryOpenEvent
and see if it is a container
if so, check the player has auth to open it
I want to make a command like /protect private and then only that person can open it
How do I get a player besides the sender in command executor?
what do you mean?
I want an op to be able to change a players info in there data file when they run a command but how do I specify that player in the CommandExecutor method cause all I see is that its just the sender not a specific player
What like:
Player player = (Player) sender;
?
Use the args.
But thats for the sender im trying to call a player thats not the sennder
Bukkit.getPlayer(args[0]); for example.
yeah
ah
After testing, interestingly on 1.16.5, it didn't say "Too expensive!" for me. Is there a specific version it'll show "Too expensive!" to, do you know?
what i then do is use a tabCompleter to add their names to the tab list
List<String> list = new ArrayList<>();
for (Player player : Bukkit.getOnlinePlayers()) {
list.add(player.getDisplayName());
}
return list;
``` like this
๐ค any ideas? I'd like to give the player a message letting them know they can still use the anvil if it says "Too expensive" but only for the version(s) needed that the player may be joining from.
define:
wouldnt work?
wgat error
Method invocation 'getType' may produce 'NullPointerException'
That aside, why don't you simply assign the level value as "bow" its self? .-.
getItem might be null
getType will never produce an NPE unless getItem is null
item.addEnchantment(Enchantment.ARROW_KNOCKBACK, bow);
well i want to add a level of arrow knockback
o wait
true
never thought of that
did i do something wrong here? https://paste.md-5.net/uvejoroluf.cs when i add perms like chest.remove.* i cant use the childrens of it, like chest.remove.item
ItemStack item = event.getItem();
if (item != null && item.getType() == Material.BOW) {```
or just check event.getItem() is not null
Perhaps that changed. I implemented that API back in like... 1.14 or something
Your perms are correct. How are is your code not working correctly?
@fluid nacelle it works but im only getting punch 1 or punch 2
rarely punch 2
o cause unsafe enchantment
got it
sorry, im using lp and when i set chest.remove.* true, the childrens dont work
like chest.remove.item
if those perms you showed are in your plugin.yml they are correct
I'm trying to spawn an entity with a PDC so I made the spawn Entity creature1 = (Entity) event.getEntity().getWorld().spawnEntity(event.getEntity().getLocation(), type); and tried to get creature1 but, it seems that I cannot get the method to an Entity so, how would I do this
Out of interest test it with GM, which will tell you if its an LP issue or not http://palmergames.com/libs/GroupManager.jar
aight give me a min
to use just log in, then in console type `/manuaddp <player> <permission>
are you tha maker of groupmanager?
yes
hes the guy
im sorry i gtg, could i tag you once im back to see if it works
if I'm about
but how will he know if your about without tagging you first?
my plugin somehow crashed my server lmao
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.
i need help with fast bridge
do you though
yes
now if only this was a plugin help channel, or we knew what fast bridge was
:/
define
Are you doing some funky NMS crap?
i can show u my code
i dont understand what happens
and the tutoriol in german and he made the host thru his pc
use setItemInMainHand(null). It accepts nullable.
You are setting to air which is causing it to throw a wobbly
most likely
!= null
no can help me : (
set to null. You are setting AIR
worked thx
can u help me bro
wydm
If fastbridge is a plugin you need #help-server
Its a plugin and its in german, neither of which I have any interest in
and what is ur problem with it?
the fast bridge
what version is ur server?
ok well
Thats a plugin issue, talk to the plugin dev or ask in #help-server
This is not the correct channel
k
how can i make values for players? for example if they can move. I want to check them later with a eventListener
what
well for example boolean canMove
if it doesn;t need to survive a server restart set a permission
do i need to put that in my main class? It seems like everything from my plugin can use it even if itsnt appliable
๐คจ
1.8 is epic
@eternal oxide for some reason even if it is null the server still crases
same crash? or different
well when i have one item in my hand and right click it it doesnt crash but when i have a stack it does crash
ah ok
in that case, you should be reducing the stack size rather than replacing the item
Hello!
goodbye
๐ข
I would like to make a falling block, with customisable material data as well as a vector with packets
however i am a bit stumped
I have this:
you have a stackable bow?
PacketContainer sandPacket = this.protocolManager.createPacket(SPAWN_ENTITY);
sandPacket.getIntegers().
write(0, 500).
write(1, (int) EntityType.FALLING_BLOCK.getTypeId()).
write(2, (event.getLocation().getBlockX())).
write(3, (event.getLocation().getBlockY())).
write(4, (event.getLocation().getBlockZ()));
sandPacket.getDataWatcherModifier().write(0,sandWatcher);
However it doesn't work
error:
I wondered if anyone could help !
no its a player head that when you right click it you get speed and absorption
i think i got the solution
omg just made a method that freezes people
but what's the difference between return true and return false when checking for permissions etc. I assume that one gives the usage message defined in plugin.yml and the other not?
@rigid dew
i mean for example this, what would happpen when i change return true to return false?
return true = do nothing
return false = display the usage from the plugin.yml for the command
What does this mean:
loaded class 0 from 1 which is not a dependent soft depend or load before or this plugin
when i try and send a packet
I have this in my plugin.yml:
depend: [ProtocolLib]
Yeah exactly, idk why it gives that tho
ive just generally ignored it because for me, it's happened even when it is depended upon.
It's just a warning so there's no physical implication
Caused by: com.comphenix.protocol.reflect.FieldAccessException: No field with type net.minecraft.server.v1_16_R3.DataWatcher exists in class PacketPlayOutSpawnEntity.
this is the error from console
yeah, mine actually errors
What version of protocollib are you using? and can you send the full error
sure
?paste
i just downloaded the most recent one
my maven depend may be old
one sec
nope
Make sure you're not packaging protocollib inside of your jar
decompile your plugin and make sure it coesn't contain com.comphenix.protocol packages
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>4.6.0</version>
<scope>provided</scope>
</dependency>
it wont
but i will check
yh it shouldnt with that
well, its 8kb so no
yh idk then
you should not shade it
@EventHandler
public void onSpawn(CreatureSpawnEvent event) {
if (event.getEntity().getPersistentDataContainer().has(new NamespacedKey(plugin, "Spwned"), PersistentDataType.INTEGER)) return;
EntityType type = event.getEntity().getType();
event.setCancelled(true);
Entity creature1 = event.getEntity().getWorld().spawnEntity(event.getEntity().getLocation(), type);
System.out.println(creature1);
PersistentDataContainer data1 = creature1.getPersistentDataContainer();
data1.set(new NamespacedKey(plugin, "Spwned"), PersistentDataType.INTEGER, 1);
event.getEntity().getWorld().spawnEntity(event.getEntity().getLocation(), type);
return;
}
Event prints a major Error that crashes the server and that is just too long
https://paste.md-5.net/sufohojemu.pl
But that is a part of it
I think Its because the mobs are infinitely spawning
yes
you are spawning two entities, applying the PDC value to the first after it was fully spawned
the event is called prior to you modifying the PDC of creature1
Use the callback version of spawn to modify an entity prior to it being added to the world
declaration: package: org.bukkit, interface: World
When you say event you mean the event that spawns the entity right? and also Thankyou so much I've been working on this for like 4 hours now
Hello there, I'm now trying to make a method that 'freezes' players, so they can't move. But for now I use the event PlayerMovement and that also blocks looking arround, is there another way so it only blocks moving (running arround) and not looking arround?
Check for the x and z.
Yeah basically what happens is:
natural spawn {
creature spawn event process {
you spawn new entity {
creature spawn event process {
......
}
}
}
}
and how do i do that XD
There is event.getFrom() and event.getTo() on PlayerMoveEvent, just compare them.
okay let's see what we can do
if(event.getTo().getBlockX() != event.getFrom().getBlockX()){
event.setCancelled(true);
}
```example, but you might want to check the Z too.
Thanks!
and also for the Y ?
or Z idk what the height is, i dont want the height
oh it already workd
When I run a command ingame its suppose to run the code bellow but instead I get a null exception dose anyone know why?
well go with your mouse over the highlighted things
why is this happening
its not the args that the console is mad about its the first if datamanger call
if is printint the passed thing
maybe posting more of the stack trace than the first line would be helpful xD
?paste
what mc version
1.12.2
you have to use the color ids
@eternal night
@clever sequoia the stacktrace not the code xD
idk what that is
the long exception message that pops up in your console
well there we have it huh. TabAPI seems to be missing
can you give a demo ? just one line code.
update the block state des
Could I have a quick example how World.spawn is used? I can't seem to understand the clazz and Consumer function parameter
chest.update(true)
world.spawn(location, Zombie.class, zombie -> {
zombie.setCustomName("Prior-world-add-name");
})
but i set as a library
do you shade the library into your plugin ?
that does not mean you shade it
how can i do that?
are you using maven ?
no
is there a reason why this is null?
you don#t have to
@clever sequoia tab api is not a pure library it is a plugin
is the plugin in your server plugin dir ?
wtf im so confused lol
so i have to drag it to the plugins folder?
ye
ok
Bukkit.getPlayer(String) might return null
wtf
what are those casts
this code errors right ?
you should be getting a bunch of exception
how can i do that?
ah yeah. ```yml
depend:
- "TabAPI"
How would I get Zombie.class from event?
ok
oh you are trying to dynamically spawn these ?
yes
event.getEntity.getType.getEntityClass()
or just
Pretty sure you can just use the type these days
entity.getClass
thx! ๐
wait
no
I lied
coll is right
entity.getClass would return the craftbukkit impl class
Note that you then obviously only have access to methods all entities share
You can cast if need be
So the method Bukkit.getPlayer returns null? how do I fix that?
It returns null if no player with that name is online
Player player = Bukkit.getPlayer(nameOfThePlayerAsString);
if (player == null) {
// player wiht that name is not online
return;
}
also intellij is already yelling at you that you are accessing args[0] before validating that the args array contains at least one element
sorry bout that im pretty sure saysing args > 1 should fix that problem
well for your case args.lenght >= 1 would also work
length of 1 means you can access index 0
ok
Thats helped fix intellij yelling at me but when I run the command with a valid name it still just says its null
TabAPI
why do people insist on writing things that might just as well be regular libraries as plugins
tbf that library had its last commit on gh in 2013 xD
how can i consistently listen to when a player holds out a certain item
listen to player item held event or whatever it's called
like PlayerItemHeldEvent just ignores picking up items, /give command, etc.
hey @wraith rapids you got any experience with protocollib
you have to switch on and off the slot or it doesnt get called
then you need to listen to inventory click/drag and player pickup event as well
and player change hand event
i bet that just checks the fucking slot every tick doesn't it
Uh huh
haram
@waxen plinth defend yourself lol
im gettin now a org.bukkit.plugin.UnknownDependencyException: TabAPI
lol
inventory.setitem(slot, item)
random.nextInt(inv.getSize())
TabAPI is not installed or goes by a different name
or is not a plugin
maybe it is a library after all
at least redempt's library is an actual library
Unless a plugin modifying a player's inventory causes an event to fire there's no better way to do it
is it not possible to get the previous main hand in PlayerChangedMainHandEvent :bruh:
Better to have it in one place
ironically enough you don't need to add it to a txt file to use it
well it's probably the opposite lmao
unlike the api
Rather than a bunch of plugins all doing it on their own
One joke
Im trying to make a cooldown but its not working
yeah that's why it's ironic
Shut up with your stupid one joke
https://github.com/Double0negative/TabAPI this is the tab api you are using right ?
because you do need to add a name to a txt file to use that other api
that is at least what I found from your package name
i use it don't judge me
I judge you positively for it
Hey gecko, how do you find the command manager?
kill him
Is it an evil thing for needing an external file?
No I mean how do you find it as in do you like it
smh
he just doesn't want to admit to sin
it's a bit more difficult to get started but it's very useful for organizing commands
i'll crunch your balls
Man why did that not open in the GitHub app
404's for me
hmm how do I share it by phone


