#help-development
1 messages · Page 1593 of 1
Saying “no” repeatedly makes you seem 8
Jfc
im saying no cuz you saying im 8 lmao
and im not 8
im older than my brother and hes 11 lol
I don't know why there's an underage discord user allowed in here.
pinnacle of spigot development channels once more
You have no solid proof of his age tho
His attitude and spelling can tell enough
That’s still not what I would define as evidence
no i just dont care about spelling
Guys we like don't care about one's age, if they're doing something wrong just tell them
It looks bad on you.
Anyways moving, keep useless debates like those away from this channel
and idkidk ftr just ignore
conclure what do i do with a domain i have for a year
like minehut lool
i seen people gotten banned for lying about being underaged
If you’re going to continue, use #general at least
I wish the rules here were more strict.
It does tho
Yes
says "i dont have permission to access this channel"
?kick @mental girder trolling
Done. That felt good.
lol
bruhh
worlds fastest rejoin?
Rude conclure smh
why does your new discord thing have lugi cap
vector = new Vector(1,0,0).normalize().multiply(16);
drone.setVelocity(vector);
what am i missing??
I’m not going to argue over this
gravity ?
ArmorStand armorStand = (ArmorStand) start.getWorld().spawnEntity(startLocation, EntityType.ARMOR_STAND);
armorStand.setGravity(false);
armorStand.setVisible(false);
armorStand.getEquipment().setHelmet(new ItemStack(Material.JUNGLE_PRESSURE_PLATE));
i did cancel gravity
Whenever I try using Color.PURPLE + "string" I get following output: https://prnt.sc/1f88suh. How do I actually make it work?
how can i make it float then 😩
then how can /tp bypass it?
moves it
oh
That's not ChatColor
So I should try ChatColor?
Yes
vector = new Vector(1,0,0).normalize().multiply(16); this moves it a lot more than 16 blocks
aight ty
im pretty sure ChatColor is from the bungee api but spigot has it as well
You can use either in spigot
Spigot has both
Bungee and Bukkit ChatColor
lmao when i said at the start "how can i move something with a vector 16 blocks" i assumed you meant it would move 16 blocks and stop
oh didnt know that
hopefully just in minecraft
Government using minecraft to design drone AI now
When he starts asking how to detect a person in an image we get worried
Anyone knows a tool for see our plugin performance?
😈
/tps
shoots itself
camera shake causes nuclear bomb
Can I find out if there is a certain block in the distance between locations?
raytrace
Location.getBlock().raytrace, right?
More options under World#raytrace
Bukkit.getScheduler().runTaskTimerAsynchronously(this.plugin, () -> {});
I forget, but how do i cancel a task like this from within the lambda, or can i not?
so like how much does a normal bo have
hmm
I already try for 5 hours to create a simple scoreboard, but showing? No way
ok
double distance = pivotPoint.distance(drone.getLocation());
drone.setVelocity(new Vector(1,0,0).multiply(distance).normalize());
if (distance == 0) cancel();
this obviously dont work cause it just overshoots and then keeps going. what is the best way to do this
i feel like i should be getting the x difference
rather than using the method
but something like this:
double distance = pivotPoint.getX() - drone.getLocation().getX();
causes it to oscillate
How do I create an inventory instance.
Your inventory IS an instance

I don't need someone frustrated telling me if I'm competent or not to learn and do.
This channel was made to help, instead of judging people, it could help and encourage them
Actually they have a point, stop trying to make a plug-in if you don’t even know basic Java
Learn the basics first then make a plug-in so you actually know what you’re doing when someone gives you help
Maybe he is trying to learn through making plugins, which can work imo
That’s a terrible idea imo, just making things harder then they need to be. That’s like trying to speak a foreign language without knowing any basic concepts
i mean you have to start somewhere
Yes with the basics
For some reason my MySQL plugin crashes other MySQL plugins when enabled on server. I dont exactly know what code to send but I have this error:
[08:28:52 ERROR]: [EssentialsMysqlStorage] Could not connect to mysql database! Error: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
[08:28:55 WARN]: [EssentialsMysqlStorage] Database connection failed. Reconnecting...
[08:28:55 INFO]: [EssentialsMysqlStorage] Connecting to the database...
[08:28:56 ERROR]: [EssentialsMysqlStorage] Could not connect to mysql database! Error: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
[08:28:56 INFO]: UUID of player Nuxoria is 66791ac2-c73d-4d04-a738-7506a4b028f2
[08:28:56 INFO]: Nuxoria lost connection: Disconnected
[08:28:59 ERROR]: [EssentialsMysqlStorage] Could not connect to mysql database! Error: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
Basic fucking programming in a language, that’s how basic. If it’s plug-in that teaches you different things the spigot api can do, or that teaches you basic Java concepts, sure that’s a great place to start.
System.out.println("Join");
org.bukkit.scoreboard.Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
Objective score = board.registerNewObjective("score", "dummy", new Component("&aTest").toLegacyText());
score.setDisplaySlot(DisplaySlot.SIDEBAR);
e.getPlayer().setScoreboard(board);
Printed "Join"
No score board visible?
i want to send a fake Item packet to client in Shield Slot without changing the item on the server
is that possible?
ClientboundSetEquipmentPacket does what you want
can someone help me with that?
?
oh you want to change the players own inventory using packets ?
Database connection failed.
ClientboundContainerSetSlotPacket is your packet then
and still allow players to use shield
an example of its usage can be found in CraftInventoryPlayer:113
We need a little more than that
Gotchu, what part of the code tho? The connection?
what do i need to do that?
checkout how it is used in the example linked
probably easiest for you
tho note, this might (idk how the client handles it) reallly screw over the client
is it default spigot? or do i need some external api?
Kind of new to java, I'm trying to get the instance of an object. The Object reference is made when a command is executed, and I'm trying to get that instance within an event. What can I do to get the reference?
it is just NMS and craftbukkit
nice!
Store it to a Field
Guys is that right?
?paste
pls use this
What do you mean?
A Field is a java Class scope variable
the object you create, store it
Yeah but when I store it, how do I get it to the click event?
You said you got it IN a click event and want to access it
i want to give ppl the item like /spickaxe "IGN"
however no matter, you access the field
I rewrote it, sorry I didn't type it very wellthe first time
^
google getters and setters
ok and what does not work?
idk, run it and you'll see
That’s not how this works, try it and see
Let's say I store the reference after the command runs. I also put a getter within the command's Class. I'm just confused as to how the click event will be able to use the getter to get the correct instance
the object you created and stored to the field is always the object (instance) you created for this field
what are you trying to do
Making an item GUI which a player can flip from page to page. It works perfectly fine until another player tries to look at each page at the same time. I made all my variables static initially which is the cause of the problem, so I'm just confused as to how I can make instances which don't require static so I don't run into that problem again
shame on you @quaint mantle @topaz moon, you both missed the Opportunity to send https://tryitands.ee/
so as I can see the error is in openConnection()
You either have a separate Inventory instance for each player who uses it, or you have one Inventory per page.
for that we have encapsulation.
each player should have its own inventory ig
Couldn’t remember the url lol
Command:
https://hastebin.com/ewazaqayix.java
Opening the GUI to a player:
https://hastebin.com/jaxikurata.java
Click Event:
https://hastebin.com/sazugakoti.java
Within the command file, I have the getter at the bottom, I'm just trying to figure out how to get it within the click event
net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket isn't showing for me
you are using mojang mappings right ?
@vital ridge where are the error messages from?
[08:28:52 ERROR]: [EssentialsMysqlStorage] Could not connect to mysql database! Error: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
we probably need to see these lines
Ill update you in a sec with the problems
Because "could not connect to mysql database!" is no helpful error message
Yeah I see you
Anyone familiar with how to shade NBT-API? The documentation here is incomplete: https://github.com/tr7zw/Item-NBT-API/wiki/Using-Gradle
normal gradle shadow plugin o.O
wtf so i can connect to a mc server with my ip on my domain but when i try to ping my domain it shows my ip but it cant make requests to it
xd
does anyone know how to put a cooldown on a custom item
i have a package called like itemmanager
how to get access to a command argument (a player argument) in another class?
but it wont accept that it wants a Material.blahblah
but i can join with play.my.domain
how did you get that IP ?
my ip
what's your domain?
version 3181-Spigot-38e6c03-ed2b91c (MC: 1.17.1) (Implementing API version 1.17.1-R0.1-SNAPSHOT) is my version
cant tell or you will get my ip
you can't ping your public IP ? xD
its .tk though
you just posted a screenshot of the ip
imagine Skript
mojang-mappings is not about the server version. It is how you compile it.
dont ban me please
so where's the difference
it doesnt have the ip in it?
lol
ah shit
????
many routers/modems disable ping
but it won't import it
Yes then you aren't using mojang mappings ?
and am curious about the problem
how are you defining your spigot maven/gradle dependency
it may drop icmp
i just added it using external jar
oh god
hey, does anyone know how to set a cooldown for a custom item, I have a package with all my items called ItemManager, but it doesnt accept that it only wants Material.poop or something
well I have no idea what the names are
or is there a plugin
for runtime
so you tell me you can ping the domain which points to the ip you cannot ping?
i should i make a maven project?
@granite stirrup
arent the method names when using the obfusticated nms a and shit?
?
Yea
^ @granite stirrup
they are pretty much random characters
i has ur ip now lmao
lmao
i cant ping my domain with the ip or ping the ip itself
confusion
we've alerady told you, you dont check the holder you check the inventory. and if you need multiple checks, use else if
ok i get your frustrations now
how can i join something that i cant ping btw
it can drop icmp
wait isn't the holder the holder itself?
I don't understand what "check inventory" means, the translation is horrible.
like donkeys and etc
pretty sure mine used to idk why it isnt now
it means, use the inventory returned from getInventory method
oh wait it's your private home ip?
which points to... your router?
yeah
^
Okay there are 0 error messages from my side
but other MySQL plugins spit out Too many connections
and couldnt enable
@quaint mantle you should try understanding what == does
Your router does not respond to pings then. The last respond I get is probably from your provider @granite stirrup
as ive said, learn the fucking basics first, that is part of the basics
How many connections are you making?
I dont know
make less?
But how?
No clue as you don;t know how many you are making
Whatsu mean making tho?
sorry havent slept
like in code?
hi, is there a main spigot development server? or is this it
Yes in code. It sounds like you are maxing out your SQL servers connections
if you need development help, ask it here
oh ok
I dont understand how tho, maybe you want to see my MySQL class?
I dont understand how I'm creating that many connections
https://pastebin.pl/view/437bc0e9 thats my MySQL class
Pastebin.pl is a website where you can store code/text online for a set period of time and share to anybody on earth
I stored an object reference after a command is run and I'm trying to use the command's getter to retrieve the reference within a click event. How can I go about doing that?
Command:
private ItemGUI gui;
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
Player player = (Player)commandSender;
gui = new ItemGUI(player,1);
}
public ItemGUI getGui() {
return gui;
}```
**Event:**
```java
@EventHandler
public void clickEvent(InventoryClickEvent e){
Player player = (Player) e.getWhoClicked();
ItemGUI gui = ItemGUI.getGUI();
if (e.getClickedInventory().equals(gui)){
e.setCancelled(true);
}
}```
config.setMaximumPoolSize(50);
Thats a lot of connections, just for your plugin
try 2 to 3
chests etc
not really
Hmm
other than max double
perhaps lead with the error, then some code?
Sorry yeah, I just went out for a walk
So no code
But I just wondered if that was the issue
Fair enough
teh simplest way to get a non zero vector is a Location.getDirection().normalize()
I think I was normalising 0,1,0 and then multiplying
Don’t ask why
I’m stoopid
Yep
Will do
Also
I am doing the thing where I multiply the vector by the distance required in a runnable, so that it decelerates and stuff
But what sorta thing should I do when the distance is really far
Should I just add an upper bound?
Yeah, the normalise I realise now was useless
b y normalizing you are limiting the upper bounds to 1 block per tick
Yeah the normalise was before I multiplied so it didn’t do shit 🤦♂️
But
If there is a distance of 2000 blocks, that is gonna go at 2000 blocks / second right?
Yeah
Mistyped
Ok…
Right ok
I mean I just take the two absolute x values and subtract them atm
Nope
I have it to do the x axis first and then the z
Which is just a proof of concept
why? just use a proper vector
use teh direction vector, normalize, multiply by however many blocks (capped)
Myeah, lemme look when I get back
?paste
Example. A tracking arrow. https://paste.md-5.net/ilehesusux.java
ClientboundContainerSetSlotPacket isn't showing for me
length not so much
is ClientboundContainerSetSlotPacket changed?
private final Map<Integer, Component> lines = new HashMap<>();
private final List<Team> teams = new ArrayList<>();
public interface Team
{
String getName();
Component getPrefix();
List<Player> getPlayers();
}
public void apply(Player player)
{
System.out.println("Applying " + lines + " and teams " + teams);
org.bukkit.scoreboard.Scoreboard scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
Objective mainBoard = scoreboard.registerNewObjective("board", "dummy", displayName.toLegacyText());
for(Map.Entry<Integer, Component> line : this.lines.entrySet())
mainBoard.getScore(line.getValue().toLegacyText()).setScore(line.getKey());
for(Team team : this.teams)
{
org.bukkit.scoreboard.Team scoreTeam = scoreboard.registerNewTeam(team.getName());
scoreTeam.setPrefix(team.getPrefix().toLegacyText());
for(me.tvhee.tvheeapi.api.player.Player teamPlayer : team.getPlayers())
scoreTeam.addEntry(teamPlayer.getName());
}
System.out.println(scoreboard);
player.setScoreboard(scoreboard);
}
What am I doing wrong here?
not using paste
This is the print btw: Applying {1=Component{text='&aTest1', center=false, prefixed=false}, 2=Component{text='&bTest2', center=false, prefixed=false}} and teams [runner, hunter, spectator] (toString returns the name)
Is there a way to check if a block can support another block (i.e. sign, torch, etc)
does facing matter?
ig it depends since for the case of a sign it would be more permissive than torch
I have the facing
it does matter
then idk
Not sure about that. There is the isOccluding for light now
so it should pass on isSolid
is mysql or mongodb better
They’re kind of made for different things
But Idk people tend to use them for things they might not have been intended for initially
re: Potion Brewing... Is there a way to get the potion just brewed? The BrewEvent looks to return the state of the brewing stand before the brew (so potions e.g. are what was in place before the brewing took place and not the final result)?
how to get access to a command argument (a player argument) from another class?
like rpg classes
mongodb (or noSQL) can scale a lot better
besides that, well it is a bit more on you to maintain structure in NoSQL
^^
slot 1,2 and 3 of its inventory will contain the output, but you can't tell what it last produced
re: "you can't tell what it last produced" ... does this mean that, in the brewevent firing at the end of the brew, we're not able to get the potion just brewed?
Not to my knowledge
huh. odd. Well... I suspose I could just create a map and infer based on the state before the brew started, but admit that seems a bit strange. Thanks for confirming in any case.
Well if the event fires then you know it brewed something. Check those three slots, but still can;t tell which
I'm seeing that those three slots return the input to the event vs. the output of the event. e.g.:
given a water in the slot[0] and wart as the ingredent, the BrewEvent returns 'Water' as being in slot[0] whereas I would have expected 'akward-potion' or soemthing like that.
0.14 > (1/3)
Why does that return 'true'...
Ya - looks like it is storing the state of the brewing stand at the start vs. at the end. The event itself fires once its cmplete from what I can tell.
yep, odd you can;t get the result though
best you can do is store the inventory IN the event and trigger a task 1 tick later to compare that to the new inventory
Ya - saw a code sample where code was queue'ing an async task to run, which appeared to do sometihng like that. now I know why 🙂
Double ed = Math.random();
if(ed > (1/spawners)){
s.remove();
Bukkit.getLogger().log(Level.INFO,ed+" "+spawners);
return;
}```
and it says 0.14 / 3. I'm not the best at math, but even I know that 0.14 is not bigger than 1/3.
why is it still triggered
wait is that a bit operator
the log message is in the if
ergo
it has brackets
The identation might be trash, but java does not care about identation
How do I get if a banner is a wall banner or standing banner and how do I get the orientation of it?
the api for it is different than for signs
((Orientable) block.getBlockData()).getOrientation()
Or somethin like this
Just checked... looks like both Paper and Spigot ultimately surface the same bukkit impl:
Paper: https://papermc.io/javadocs/paper/1.13/org/bukkit/event/inventory/BrewEvent.html
Spigot: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/inventory/BrewEvent.html
it doesnt have orientation or facing
it is just a TileState with colour stuff
no directional
Then Orientable
bruh ok lol
There is no Banner blockdata
is it a BannerMeta?
thats just items right
man banners are implemented weird
also doesn't help that the BlockDropItem event is broken, so you can't easily stop (or detect) supported blocks from breaking
ok
I'll try Orientable
That or Directional
Orientable makes more sense cause it's more similar to a lever in that it can be placed on wall/floor and rotated around the up axis
What about the Wall variant?
i want to get to have access to target from another class for an eventhandler
weird that they decided to implement it as two classes for signs but as one class for banners in the API
how am i supposed to do it?
Well, Directional is only in 90° Angles
oops ignore the weird domain/embed
yea but not in API
Bukkit.getPlayer()
yea
wdym
for blockdata, anyway
blockdata or blockstate?
they should fix banners and block popping off events
i want to use the argument used in this class in another class to handle an invetory click event
hm, complicated
bukkit way makes more sense semantically imo
that is only because you are aquainted to it
i used InventoryOpenEvent
but it doesn't do anything then i press e
what is my mistake?
it works then i open chest..
does player.getInventory().contains include the chest they have open?
is there even a packet that is sent in this instance?
no
if (e.getInventory() == e.getPlayer().getInventory()) {
}
this is what i'm trying
i dont think its a mistake it's probably a seperate event if one at all
thank you!@
i want to do something then player opens it own inventory
Hello everyone !
Sorry if I'm bothering, I need a little help with the Spigot API.
I created a custom GUI, and to do this I created a "BmGUI" object and implemented the InventoryHolder interface.
In my listener, when I check if the interface is indeed an instance of the custom inventory, it returns false ...
Why ?
Is there something I don't understand ?
I'm not sure if this is a bug or not but spawning a simple armorstand with arms, and right-clicking on its head with an item calls PlayerInteractEvent with LEFT_CLICK_AIR action
I tested this in 1.16 too, and it was the same, that's why I'm not sure if it's a bug or not
it clicked AIR block
I'm not sure what you're trying to say.
PlayerInteractEntityEvent
Armorstand is certainly not a block.
basically entities are no considered solid
which is why it has to opt in for being air
I'm talking about PlayerInteractEvent
LEFT_CLICK_AIR = IS AIR BLOCK CLICK
im trying to my plugin checks for updates and i can't do that it works, i have this, so, i don't see anything incorrect or an error
Okay, let's say it is but why is it left click and not right click?
Armor stand is not a soild block but an entity
How does that change the fact that the player right-clicked?
ok lemme what is you want to make?
yeah, it is likely a protocol limitation
I expect PlayerInteractEvent#getAction() to return RIGHT_CLICK_AIR when right-clicking on an armorstand, not LEFT_CLICK_AIR
ArmorStands have their own interact events too
if this is done persistently then it is likely a fuckup at the protocol level - someone would have noticed it well earlier
if you want to click Armorstand use PlayerInteractEntityEvent
getClicked Entity
you add Action to click for right or left
or if specifically right clicking an armor stand https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerArmorStandManipulateEvent.html
How do I handle left-clicks PlayerInteractEntityEvent?
if(e.getClickedEntity instance of ArmorStand){
ArmorStand Armorstand (ArmorStand)e.getClickedEntity
}
one sec
Damage event
i gotta write it out in my IDE
what if the armorstand is invulnerable? Would it still work?
I'll try it
or FinalDamage will be zero
invulnerable then it can't take damage
but players in creative can still remove it
i think...
yes, but it'll still somehow emit some kind of event even for normal players
invulnerability isn't sent to the client after all (I think)
these 2
you need
Left Click? onEntityDamageByEntity
Right Click? PlayerInteractEntityEvent
geol was right, it emits the event in a cancelled state
Yeah, I think I can get things working with these two events.
I'll still report this to md5 if I saw him around just in case
thanks everyone :>
so my code is an atrocity
i was wondering if someone could lead me in the direction to fix the bugs noted
if this is too close to spoon feeding thats alright no worries but i was just curious as i have no clue what to do
inventory.setItem(6, new ItemStack(Material.AIR)); /// Can the way this is performed be optimized?
For loop can do it, though this would be less performant I guess
ahhh
I'm pretty sure setting it null works just fine
if (event.getView().getTitle().equalsIgnoreCase("Crafting")) {
use instanceof https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/CraftingInventory.html instead (after getting the inventory that is)
ah
why are you invoking these lines with every click anyways?
bc i dont know another way of doing it haha
if (event.getInventory().getItem(10) == new ItemStack(Material.AIR)) { // This check doesn't work
This will never work because == is instance comparision
better do getItem().getMaterial() == Material.AIR or getMaterial().isAir()
oh-
make sure to properly null check it though, getItem is nullable
ahhh you're right
uhh
.getMaterial isn't valid
"cant resolve GetMaterial() in ItemStack"
(event.getInventory().getItem(10).getMaterial() == Material.AIR)
Ah, it's getType
@smoky finch i checked it out what you're looking for is PlayerInteractAtEntityEvent
did you read the javadoc of that event?
It explciitly tells you that it is right clicking only
@EventHandler
public void EntityArmorClick(PlayerInteractAtEntityEvent e) {
e.getPlayer().sendMessage("You Clicked " + e.getRightClicked().getType());
if(e.getRightClicked() instanceof ArmorStand) {
ArmorStand Armorstand = ((ArmorStand) e.getRightClicked());
Armorstand.setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
}
}
yes i read it
but it would be possible to use EntityDamageEvent maybe
Represents an event that is called when a player right clicks an entity that also contains the location where the entity was clicked.
Note that the client may sometimes spuriously send this packet in addition to PlayerInteractEntityEvent. Users are advised to listen to this (parent) class unless specifically required.
But bukkit impl has always been really whack, so if it is firing for left clicks I would not be surprised
whats the event for when you're placing down an item? InventoryClickEvent only triggers when you pick up the item
ive been searching but the only thing that comes up is InventoryClickEvent
yup
doesn't trigger when placing an item
uhh?
It should
then i've done something wrong
its only updating the gui if i put the item in the slot then pick it up
here i'll record a video
bc idk if im explaining it right
1 sec
Why is spigot so difficult when it comes to trying to use other APIs? Trying to make a discord bot linked to my mc server and keep getting this error: https://hastebin.de/viqugozoxo.csharp
That's a known classloading issue that I do not know how to solve
The classloader in general LOVES to waste your time
I am realizing that
are you using the new shiny library feature of spigot or nah?
public static void onCreatureSpawn(CreatureSpawnEvent event) {
if (event.getEntityType() == EntityType.CREEPER) {
Creeper creeper = (Creeper) event.getEntity();
}
}
How do I check.....
I already told that
why is that i need to cast Creeper when its already confirmed that the entity is a creeper?
this is updated code with check for null and no ==
If you do not know what it is you are not using it
if (event.getInventory().getItem(10).getType().equals(null)) {}
reeeee
on this episode of "learning about sins by commiting them"
1.) Empty if block
2.)Use == to compare null
is .equals also ==
no
OH
Ik what it is, ik I am not using it. Can you refer me to something that shows how to implement it.
I don't think it would help to be honest
.equals will have the effect but looks less clean when doing .equals(null)
oh so its fine just like "this is better"
plus it can (not saying that it will) produce NPEs if the API is written badly
ahhh alright
can i have my server continue running and update it with changes to the plugin at the same time??
not always, but yes, usually it will
You can override the equal method to do whacky shit, but in this instance it'll do an instanceof beforehand which will sort this out
"if it works then you've got bigger issues" basically
event.getInventory().getItem(10).getType() == null
This will produce an NPE if getItem is null. do event.getInventory().getItem(10) == null instead
alright!
ahhh
yea
This is an artifact of minecraft history as I think up until 1.6.x empty items used to be null internally
IIRC in the Bukkit code, they actually do set to null always (like for example if you set it to air the slot will be null)
i need help to fix it, i don't know why it doesn't work properly
now 11 major versions later we will still have to deal with the pain of it
no way! Thats around when i started playing
i am the curse that brought this upon you /j
what my problem
i use InventoryOpenEvent
but nothing happens then i press e
Bukkit in a nutshell is "after having been written in minecraft beta 1.6, this class was not changed due to backwards compat"
that being said, I do support backwards compat. It's such a nice thing to have as a developer.
Until 99% of the code is abruptly changed
InventoryOpenEvent doesn't support this but i did some googling for you
there is no event afaik
^
this person uses packets
@Override
public void onPacketReceiving(PacketEvent event){
if(event.getPacket().getClientCommands().read(0) == EnumWrappers.ClientCommand.OPEN_INVENTORY_ACHIEVEMENT){
Player player = event.getPlayer();
//Do something
}
}
});```
super clever usage
no clue what it means
wait
im so used to just saying that i do understand what it means
When I add bStats to my plugin, I get this: java.lang.IllegalStateException: bStats Metrics class has not been relocated correctly!. Any ideas? Ping me if you can help.
maven or gradle?
maven
Good.
i hate gradle
I
Then you'd need something like https://github.com/Geolykt/EnchantmentsPlus/blob/4xx/pom.xml#L244-L264
just don't use the snapshot version but the latest stable one
how can I setup bossbap par player so I can just access the active boss bar of a particular player and hide it?
It's imported correctly.
Really?
I have the classes.
oh, you copy & pasted the classes?
is there an alternative to InventoryCreativeEvent for survival? it has putting down an item in their inventory unlike InventoryClickEvent
This event is called when a player in creative mode puts down or picks up an item in their inventory / hotbar and when they drop items from their Inventory while in creative mode.
Hi guys. I'm trying to cancel the InventoryClickEvent when a player moves an item in the inventory using the numeric keys. I want to cancel this event when a player puts his cursor in an empty slot and presses the item slot button (1-9). I tried this, but it doesn't work. Any suggestions?
but did you actually shade relocate them?
I didn't shade them.
I have no idea.
?
event.setCanceled(true);
and try to use equals if == doesnt work
^^^^ so it wont get lost
I know, telling for future problems
Basically, you lied
confused
InventoryMoveItemEvent
Called when some entity or block (e.g.
theres nothing listed?
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/package-summary.html
You either copy & pasted the files or you shaded in the classes
it's just (e.g.
If you did neither you would get a ClassDefNotFoundError/ClassNotFoundException
idk
WAIT
It there a delay in the stats going to the bStats website because the error went away? Again please ping me.
uhh??? what?
if (args.length <= 1) {
List<String> list = Arrays.asList("settings");
if (sender.isOp()) {
list.add("update");
}
return list;
}
Arrays.asList is a ArrayList btw
so InventoryClickEvent should definetly be applying when I put down an item in my inventory
oh true, lol
or am i misunderstanding/should i be using a different event
yeah that makes sense then
yup
Someone, knows how to unload chunks with packets on mc 1.8 (R3)?
do you mean as its flying to go over terrain?
more complicated
I saw a video by the guys that made satisfactory yesterday and they did it essentially by chunk they had a height that their drones could fly over
you would need to raytrace from yoru current position, to yoru destination
if you hit a block then either go over or around
hmm yeah that could work,
raytrace
if block hit ->
fly over it
yes, half an hour
im not too sure on how to get the going up/ down to be smooth
maybe just using smaller vectors
So from when I first start it it will be half an hour until I first see the new stats?
sometimes less, sometimes more, bstats updates every half an hour (more or less) which is why you will see a delay
ok pog because i thought i had still done something wrong
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html#rayTraceBlocks(org.bukkit.Location,org.bukkit.util.Vector,double,org.bukkit.FluidCollisionMode,boolean) If not null you have a collision, so see where that collision is, then check above it until you find a clear block, then raytrace again to that point
You can enable debug mode in the bstats config to see more info
ok
ill wait for now
How can I stop from the public void run() {} ?
just return based on a condition?
like so
public void run() {
waitTime -= 1;
if (waitTime == 0){
stop();
}
return is enough?
but the function is repeating
What are you implementing?
No, what class/interface?
scheduleSyncRepeatingTask
That is not a Class nor an Interface
Integer task = Bukkit.getScheduler().scheduleSyncRepeatingTask(warpSystem, new Runnable() {
Integer waitTime = tpaWaitTime;
Integer progress = tpaWaitTime / waitTime;
@Override
public void run() {
waitTime -= 1;
updateTpaBar(playerToTp)
if (waitTime == 0){
playerToTp.teleport(player.getLocation());
}
}
},0,20);
full thing
Well, now we are getting somewhere
Implement Consumer<BukkitTask> instead
would look something like
Bukkit.getScheduler().scheduleSyncRepeatingTask(warpSystem, new Consumer<BukkitTask>() {
Integer waitTime = tpaWaitTime;
Integer progress = tpaWaitTime / waitTime;
@Override
public void accept(BukkitTask task) {
waitTime -= 1;
updateTpaBar(playerToTp)
if (waitTime == 0){
task.cancel();
playerToTp.teleport(player.getLocation());
}
}
},0,20);
or extend BukkitRunnable
Though you wouldn't be able to use the Bukkit scheduler without using deprecated methods, so ...
task.cancel() not stop() is all
ah right
and Consumer not supplier 😉
yeps
?paste your exact code
You were given new code so yours should have changed
I asumed this was the fix
1 sec
Bukkit.getScheduler().scheduleSyncRepeatingTask(warpSystem, new Consumer<BukkitTask>() {
Integer waitTimeLeft = tpaWaitTime;
Integer progress = (1 / tpaWaitTime) * waitTimeLeft;
@Override
public void accept(BukkitTask task) {
waitTimeLeft -= 1;
updateTpaBar(playerToTp, waitTimeLeft, progress);
if (waitTimeLeft == 0){
playerToTp.teleport(player.getLocation());
}
}
},0,20);
Cannot resolve method 'scheduleSyncRepeatingTask(me.axilirate.warpsystem.WarpSystem, anonymous org.bukkit.util.Consumer<org.bukkit.scheduler.BukkitTask>, int, int)'
why does bukkit have 1000 scheduling methods
change scheduleSyncRepeatingTask to runTaskTimer
same error
Backwards compatibility 🙃
it can;t be teh same error
but at least they could fix the javadoc without breaking backwards compat
Yep
And like some return void and some BukkitTask
import the java.util.function Consumer instead
It works!
Bukkit.getScheduler().runTaskTimer(this, new Consumer<BukkitTask>() {
Integer waitTime = tpaWaitTime;
Integer progress = tpaWaitTime / waitTime;
@Override
public void accept(BukkitTask task) {
waitTime -= 1;
updateTpaBar(playerToTp)
if (waitTime == 0){
task.cancel();
playerToTp.teleport(player.getLocation());
}
}
},0,20);``` Thsi is what I have and no error
The org.bukkit.util Consumer is here for idk why
it doesn't even extend the Java 8 consumer, so it cannot be for backwards compat reasons
yep, change that to your instance. I only changed it to test
hey.. any idea whats causing this? it only happens when i use /restart
Try removing/lower the -Xms argument
what is the Xms
It's the initial memory size
I'd imagine what's happening is your other server hasn't released all it's memory, so when the new one tries allocating 7GB it can't
ah
hi guys, i've made a plugin for my server which introduces classes, like warrior and stuff, tho i have some of theese classes having effects and i made a method that applies them to the player. Sadly when the player dies it loses the effects
i've tried using playerrespawnevent with no success, anyone knows how to do?
so u think like 3ticks is ok?
That's probably fine
try it and see
In your delayed method, get a fresh Player reference from their UID. The current one may be stale
so using like Bukkit.getPlayer
yep
^
You need 7smile7 for that. He was playing around with protocol lib and unloading
@lost matrix ^
if he responds you may be in luck
Ok, thanks you
Hi, I'm new to plugin development, and does someone know how can I assign custom variable to player?
Explain your use case as there are multiple ways
I'm making a FreezeCommand, and I would like to mark player as freezed (boolean)
it needs to persist through restarts?
not really
then just put their UUID in a Set
ok
if they are in there, keep them frozen
hey how do i fix this
Hello, i'm trying to make a command when i'm clicking into a item in gui
like: item name = Jack
and when i'm clicking on it makes me type
/tp Jack
i have tried to type:
Player target = Bukkit.getPlayerExact(e.getCurrentItem().getItemMeta().getDisplayName());
but that does not work
can someone help please
@eternal oxide let's say for example he wanted to have a custom player object and attach a frozen Boolean to it. Could you like extend CraftPlayer, or just make your own player object and instantiate with Spigots's Player object or what might be the best way to do that?
Thats what the PDC is for
I've always kinda wondered what the best way to create a custom Player object would be
Oh interesting
I really should look into pdc
?pdc
well any one well help me xd?
Thanks
Does it throw an error?
yes
Probably missing some key metadata, I think Author and Title are required along with pages
ahhhh
What is it
CustomLocation#stringToLocation is returning null
I used this code
@EventHandler
public void onDamage(EntityDamageByEntityEvent e){
if (e.getDamager() instanceof Player){
if (((Player) e.getDamager()).getItemInUse().equals(ItemManager.spear)){
e.getDamager().sendMessage(ChatColor.GRAY + "You attacked with a spear! - " + ChatColor.RED + "Admin Tools");
}
}
}
and i used a spear on a mob but nothing got send
Try getInventory().getItemInMainHand() instead of getItemInUse()
it works now thanks!
but it does double hits...
Wdym it double hits
Maybe try using isSimilar instead of equals? That's good for comparing ItemStacks but idk if it's gonna fix that
okay thanks ig!
What's the name of player attacking event?
EntityDamageByEntityEvent
thx
I dont think you can force the client to unload chunks in 1.8
Its up to the client to decide when to unload the chunks. But i can take a quick look at the protocol just to be sure.
How can I get hurt entity in this event?
Ok it is possible if you send a chunk data packet with a spcific bit mask following the old SMP Map format:
https://wiki.vg/Chunk_Format
getEntity
thx
So send a packet with Ground-Up Continuous=true and no 16^3 chunks (eg. Primary Bit Mask=0)
Hey, so what would the vector for something like this be, is it just the vector that the entity is looking?
If you want to ray trace in the direction the entitiy is looking then yes.
But i have no idea what you are trying to do XD
drones
everthing is drones
but
i need to have some sort of basic object avoidance
literally gonna be:
something in way -> go up and try again
You would need to calculate teh vector from source to destination.
the simple formula I showed earlier
yep
could i just use teh method from entity
iirc it takes a range arg
you mean teh getDirection? no
You should have already ran that, found a blockage, moved up until AIR, then you need to get the vector from source to the new location
yeah, i am a little bit behind >< i took a break
basically its...
try catch everywhere XD
- raytrace path to your destination.
- If raytrace != null check result for the block you collided with.
- check blocks going up until AIR.
- get new vector from source to AIR and raytrace.
- If result == null fly there.
Hmm, the issue is that you may have something like this:
cause it doesn't see anything
but, it is two blocks tall
how do i deal custom damage to a mob from out a different class?
Hi so I get an error (https://paste.md-5.net/tepafibugu.sql) whenever moving my item into custom gui (https://paste.md-5.net/udetuxojad.cs)
anyone know whats up?
i have my null check though
if (event.getInventory().getItem(10) == null || event.getInventory().getItem(10).getType().isAir())
nyes
Depends
functionally, it is teh same
Just that .isAir is a bit broader so we are going to use that instead
Your null check doesn't do anything against checking future null references though
oh ok
WAIT
theres no null checks for if (event.getSlot() == 12 && event.getCurrentItem().isSimilar(new ItemStack(Material.WOODEN_SWORD))) {
which is probably the problem-
Can you even read stacktraces?
- your don't have brackets on your "null check", which is most likely not intended
not sure what you mean
so
Well,
if (event.getInventory().getItem(10).getItemMeta().getDisplayName()
it the error line
an armor stand hitbox is 2 blocks high but the raytracing is done from the "eyes"
the line you suggested does not have anything with getItemMeta, so it cannot apply
so it don't detect shit to go over
(gotta love J15+ NPEs)
ahhh
I should be reading closer probably haha
sorry about that! Im extremely tired and cant sleep cus sleep schedule I promise you wont get these types of questions again
if I player#closeInventory() and then player.openInventory(), how can I make the cursor not reset itself? It's really annoying to always move the mouse back to the GUI after I change the menu.
then don't use the raytrace from the entity, get teh world raytrace passing the entity location , which will be its feet
yeah true
Hi anyone knows how to do an countdown but with the characteristic that can be rewrite?
Ej.
/countdown 30
29
28
27
/countdown 30
29
28
Just use a bukkit runnable and input a variable for the delay?
I mean i want to the variable changes in real time
Then just cancel the old bukkit runnable and run a new one with the updated variable
If that’s what you want
wait is there a way to make them just like "spectator mode" through things
cause say you had an overhang
there is no way to get around this unless you pre-emptively go up
in that case you are going ot have to run a tree search
yes
well, how i was thinking of stealing anyways
ok
so i am just feeding off you at this point
but can i work out the chunk in front of the drone
i forget whether the RayTrace can hit air blocks
no only impassable blocks (including portal blocks)
hmm, somehow i need the first block that is in the line of sight that is not the same chunk
then i can just work out the max height of the chunk
then i can just fly up to avoid everything
and hey presto
You could also just implement an A* pathfinding algo. It works and scales quite well in a voxel based world.
is it not 2d though?
just take a cross section at a certain y i guess
You can implement that algorithm N dimensional

This seems hard lmao
lemme have a bit of a read
https://github.com/greerviau/Path-Finding Damm this is cool
I think thats a common thing ^^ i too have such a repo from when i played around with pathfining algorithms back then:
https://github.com/Flo0/AscIIPathfinding
coool
Ive just read some stuff and A* might actually look too "blocky" in 3d space.
The fact that we can ray trace makes me think that maybe a Lazy Theta* implementation would be better here.
I'm having a play at teh moment. Just getting a test plugin setup
i mean, i kinda understood how A* worked. but this just looks 🤯
niceeeeee
i mean, if we really didn't care about speed we could just take a cross section at a certain y level and do A* in 2d
Same XD
Im thinking of a simple implementation that can avoid simple obstacles by shooting a cone of rays
True, i mean most obstacles are just singular mountains / buildings etc
Hey, does someone helps with beginning Plugin Developers? Or am i not on the right place for that?
You are free to ask any questions you have here if it refers to plugin development
Alright,
I'm a beginner with Java Plugins and i saw a plugin for License Systems! My whole code works. But I have a question! Because I'm a beginning Developer, how can i make a config where the post the license key! And if the license key is wrong, it will disable the plugin?
I have this code atm
package me.mtaddons.Tutorial;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
public final class TutorialMain extends JavaPlugin implements Listener {
FileConfiguration config = getConfig();
@Override
public void onEnable() {
if(!new AdvancedLicense("Y7NG-T7OG-84OT-0CZK", "https://mtaddons.000webhostapp.com/verify.php", this).register()) return;
//config.addDefault("YouAreAwesome", true);
//config.options().copyDefaults(true);
//saveConfig();
//getServer().getPluginManager().registerEvents(this, this);
//}
//@EventHandler
//public void onPlayerJoin(PlayerJoinEvent event) {
//Player player = event.getPlayer();
//if (config.getBoolean("YouAreAwesome")) {
//player.sendMessage("You are awesome!");
//} else {
//player.sendMessage("You are not awesome...");
//}
//}
@Override
public void onDisable() {
}
}
So i readed the spigot site and learned making config's so that's done, but how can I implement the license to the config and check if its true or false?
Is this not against the TOS
Why is it against the TOS?
On the Spigot site, if you upload a resource they do not allow license systems
I thought that it should not rely on external licenses and rack summed it up
The plugin has to work 100% even if the server has no internet connection.
I can use PacketPlayOutMapChunk.class or I need to inject a custom packet?
so as long as you don't post it on spigotmc.org it is fine
Just a regular chunk packet
what are you doing?
He wants to unload chunks in 1.8
I'm trying to force the client to unload a chunk throu packets
ah ok
It is working, but now you need to edit the code for entering the good license. I want that you can set the "license" in the config. So i don't have to change the code the whole time and they can do it
You understand me?
So for future reference for large blocks of code use a paste site like https://paste.md-5.net/ to stop spam in this chat.
You would have to get a string from the config which would be the license and then execute it against advanced license to check it; and to disable it I believe you can do Bukkit.getPluginManager.disablePlugin(this) I believe
It does not matter
i get you
So yes
Thats great to hear.
Me thinking in my head: In speaking Chinese to them
What’s the issue?
you would save the config.yml to the resources and then they can just edit the file
Nope
In 1.8 (R1, R2 and R3) there is no a PacketPlayOutUnloadChunk class, so I'm trying to find a way to force the client to unload a chunk.
i got it
But i don't want that they see the code.
yeah, well unless they decompile it they wont see the code
I just want that you can put the license key in a config, and it executes the code if the "license" is true from the code. If its not true, the plugin will get disabled
k
Uhh should i explain it again?
You probably need to read and understand the SMP Map format to know how to construct the bit mask:
https://wiki.vg/Chunk_Format
Thats what you get for using a version thats half a decade old.
- Save a config.yml
- Read the config.yml :
getConfig().getString("path") - Check the key against Advanced Lisence
- if it is not valid disable the plugin like rack said
- if not just continue
^
uhh wdym with "path"
the yaml path
true
then i will just stop 😦
what they mean is that yaml is a simple concept and this lisencing is normally for advanced plugins. not to dishearten you
Or chunkbulk
You should probably pour more energy into other aspects that will make your plugin great 😄
The user usually doesnt care for stuff like licenses but rather features.
ok
Can anyone help me fix this mild error? Cause what im trying to do is make it so when a user goes in the config to change the item name, it sets it to that name, instead of a preset name by the plugin.
Cuz i've been kind of stuck on this
You are most likely not in a class that extends JavaPlugin
therefore the getConfig() method is not available
Yeah but i tried it in that class that extends JavaPlugin and it still shows the same issue,
umm, it shouldn't
Erm hold up let me check something..
Yeah not getConfig() still has that issue
See
static 👀
Thank you
what does it say the error is
I just had to remove static xd
ah
Thank you lol, i fr been trying so HARD to figure out what the hell the issue was for the past day now lol
Xd
🥲
also copied ur status ty
ah yes, :earth_africa:
you didnt see that
something like this?
private File setupFile = new Fule(getDataFolder(), child: "config.yml");
private FileConfiguration setupConfig = YamlConfiguration.loadConfiguration(setupFile);
cool
java.lang.NoClassDefFoundError: net/minecraft/server/v1_8_R3/IChatBaseComponent
wrong version
Nope
Were they even out?
hm?
