#help-development
1 messages · Page 1445 of 1
There isnt a good jar for 1.16 Factions
period XD
plus, none of the players would wanna swap anyways
Faction is one the most unoriginal by now. It has stayed the same for almost a decade now with just minor insignificant feature additions.
It really isn’t they entire mode depends on tnt cannoning which if I’m correct hasn’t changed
It’s not like something else is used nowadays
new cannoning concepts
cannoning nonetheless?
That’s not a significant change on its own
Never found factions enjoyable
completely different.
Okay name some new cannon concepts
!!!500 DOLLAR SERVER JAR!!!!
Which isn’t just a tweak of something already existing
U Fusions, Up Downs, Webbust nukes, Overstackers
Wouldn’t say that’s super new
i mean, they are all within the past year
Anyways none of them aren’t something which pioneers factions turning it into something new imo
it's just a different way of blowing things up which either way shit is still being blown up
What if factions would add siege machines or something
wdym
that would be very interesting for instance
would never work
Why not
That's pretty much what the creeper eggs are
Creeper eggs are bombs literally
because raids involve 6+hours of forcing a base while people patch and you try to counter cannon... how would a siege machine even work?
Anyone know why this falling block has a weird jerk as it starts going down?
change the 2 to like a 3 or a 4 to change where it is, i forget which one is for the middle of the screen
Idk there are some cool ones just google
there arnt on any comp factions servers
Comp factions = pay to win
No not any on fac servers because it has literally never been done if I’m correct
Archon literally has no p2w features at all and is the most comp one
:/
Or maybe some poor attempt but that’s beside the point
yeah they got unblacklisted by mojang recently
minesuperior too
How bad is doing everything in one class anyways
archon is p2w lol
Is it possible to get the hostname in AsyncPlayerPreLoginEvent?
?paste
The just did that
not anymore
@dense kestrel long time no see
try {
java.lang.reflect.Field id = newEntity.getClass().getDeclaredField("a");
id.setAccessible(true);
id.set(newEntity, player.getEntityId());
}
catch (Exception e) {
return true;
}
PacketPlayOutEntityDestroy oldPlayer = new PacketPlayOutEntityDestroy(new int[] { entity.getEntityId() });
((CraftEntity) entity).getHandle().playerConnection.sendPacket(oldPlayer); Error --> playerConnection cannot be resolved or is not a field
((CraftEntity) entity).getHandle().playerConnection.sendPacket(newEntity);
}
Stop asking here
anyone know how I can store my banlist on mysql?
how do i fix this error?
so all servers on bungeecord share the same ban list?
Doesn't getHandle return an object? Which means you can call playerConnection on it
cool haha
playerConnection cannot be resolved or is not a field...
one sec
ima look
I'd recommend using Protocollib instead of working with NMS
It wil make your life easier especially if you don't know what you're doing
is entity a player?
Yes i am using Protocollib and packets are new thing for me.
lmao i just bought the que skip on 2bt2
Only CraftPlayer::getHandle (it’s an EntityPlayer or smtng) has the playerConnection field
i get on in 10 min
That code isn't Protocollib?
whats that have to do with this channel?..
Entity
how can i get the itemMeta of a block that's placed down?
(block that is right-clicked)
But an entity may not be a player entity
. @violet depot
did you check that?
thats the only issue i see
wait
how can i get the itemMeta of a block that's placed down?
(block that is right-clicked)
player.getItemInHand()
on BlockPlaceEvent
if (entity instanceof CraftPlayer) {
((CraftPlayer) entity).getHandle().playerConnection.sendPacket(...);
}
uhh
@violet depot now please compare
entity is not a player
it needs to be a player
If it’s not then it won’t have the field playerConnection thus it cannot receive packets
Its's a block that's placed down before, I already have this to do something with
Block block = event.getClickedBlock();
Maybe Block.getDrops()?
no?
its not that
yea
get the item in hand on BlockPlaceEvent
thats the block they are placing
(the block is still in their hand when the event is called and is only placed after your code runs)
does this execute a function every half second?```java
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin {
volatile boolean check_tick;
@Override
public void onEnable() {
check_tick = true;
//events go here
while (check_tick) {
//function to be executed();
try {
wait(500,0);//executes once every half second
}
catch (InterruptedException ignored) {
}
}
}
@Override
public void onDisable() {
check_tick = false;
}
}
Why is that volatile
use scheduler
no idea, intellij said it should be
how do you do that?
Probably because it thinks you’re working in a multithreading environment with that variable
well, there are some events
Well in fact in want to store an UUID (converted to string )inside the persistant data container and i tried to make a container
PersistentDataContainer container = itemMeta.getPersistentDataContainer();
but i can't reach the itemMeta
Bukkit.getScheduler().runTaskTimer(plugin, () -> {
},0, 10);
then i want to use something like this
if(container.has(key , PersistentDataType.STRING)) {
that will loop every half second forever
untill the server goes offline?
yea
shouldn't it be Bukkit.getScheduler().runTaskTimer(this,function here,10,0)?
do I really need to call the method .getPersistantDataContainer of an itemMeta object? (I cant easily get the itemmeta)
if its in your main class yes
no, shouldn't the 10 and 0 be reversed?
the first number is the delay before the first run
the second number is how often it repeats
ok, thanks!
also
the period time unit is ticks, right?
Yes
new BukkitRunnable() {
@Override
public void run() {
if () {
cancel();
} else {
//code
}
}
}.runTaskTimer(plugin, 0, 10);
you can do that too @livid tundra
Any1 need help?
thanks!
np
I always use BukkitRunnable
i use BukkitRunnable if i need the task to be canceled at any point
otherwise i dont use it
Yeah I always want to be able to cancel it
where does that go?
fair enough, i mainly use scheduler for infinite loops though
same area as the other one
so it's ```java
import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.ArrayList;
public class Main extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
OnTick ontick = new OnTick(getServer().getWorlds().get(0),list_of_player_blocks);
//events
new BukkitRunnable() {
@Override
public void run(){
if(false){
return ;
}
else {
ontick.creepersExplode();
}
}
}.runTaskTimer(this,0,10);
is return ; a suitable subsitute?
No
umm
is there someway to get the ItemMeta of a block, a player rightclicked on?
That will return back to the beginning of the loop
do you know how to code @livid tundra ..?
new to java
Google Java coding conventions
ahh
Also if(false) is useless
Read them and follow them
return; is dead code
that's the point, I'm thinking of changeing it in the future, but I want it to always execute for now
It should say it’s from the 90s, the standard doesn’t change much so it’s still mostly up to date
Ah ok
I can’t think of anything that’s changed since then and I also can’t find more updated ones
ima go to bed, talk to yall later
Well dont use return; to cancel that will only cancel the current iteration
Ah yes ofc
Returning a runnable ends that iteration
can i convert an Itemstack to Block?
(ItemStack) event.getClickedBlock() inside eventHandler
You mean block to itemstack?
If so just create a new ItemStack with the material (getMaterial) of the block
or you can break the block to get correct drops
Guys hello i need help i have eg this Map<String, Object> element:
{type=DIAMOND_SWORD, meta={displayName= Hello sword , lore=[Sword top , Nice sword . ], enchantments={Enchantment[16, DAMAGE_ALL]=5.0, Enchantment[34, DURABILITY]=3.0, Enchantment[70, MENDING]=1.0, Enchantment[71, VANISHING_CURSE]=1.0}, repairCost=15.0, hideFlag=0.0, unbreakable=false, unhandledTags={}}}
is serialized map object i convert him to json (lib Gson) later unserialize this object to itemstack.
after which all itemmeta data disappears
Why are you serializing it with Gson?
oh
hwo do people make inv listeners? i have always used if(event.getView.getTitle.equals("name of the inv"){ do stuff}
but i saw a few times this is not a secure way of doing it since if another plugin makes a gui named name of the inv then my plugin will fire
and converting to json for save to db
How can this be fixed? 😄
Not sure
i already fixed it by making the listener in the same class as the gui creation
so i can do private Inventory inv;
does anyone know how I can get a top of a line from a yaml configuration, but checking if it contains specific substrings or if there are two
example:
howdy do
my command doesnt seem to be working
https://paste.md-5.net/ipaguxetec.java
my other commands work but this one doesnt
Make sure you added it to your plugin.yml
could someone tell me why this event is not running?
the gui buils but the event doesnt fire
i already registered it in the main class
dose this seem to be about right?
public void eventRegister(){
getServer().getPluginManager().registerEvents(new CreateGeneralGUI(), this);
}
Use == for enums and ^^
Also why are you comparing Enum value with null
ok good to know
it will never be anything other than the enum constant described by DamageCause.FIRE_TICK
my ide says I need to insert a null checker
can i see the code where you add the defaults? how did you add the # like that?
that is not a condition
if (something == DamageCause.FIRE_TICK)
is what you're looking for
in your case, you've substituted "something" with null
which is stupid
because FIRE_TICK will never be null
oh my bad
and the result is always the same because you are comparing 2 constants
later..
#help-development message can anybody help me?
getKeys(false).size?
public void playerDamage(Player event){
structure your configuration so you don't need to hack at it
the event ur trying to get also doesn't exist
this too lol
try public void playerDamage(EntityDamageEvent event)
then check if entity is a player
what you mean with it
?xy
Asking about your attempted solution rather than your actual problem
is there any reason bukkit.getplayer(uuid) would ever fail if the player is online? I'm using a valid uuid of an online player, but it is still returning null. The server isn't on online mode so I can test two clients, could this affect it?
however it is using the offline mode uuid
just buy two accounts bro
offline mode is yucky ¯_(ツ)_/¯
well i'm not asking for ethical help
this would probably answer it though
it should still work
as it doesn't do any requests to mojang or anything
seems rather strange for it not to work
https://paste.md-5.net/ehokuviwup.java any idea why this sometimes calls the dispense event again?
@glossy scroll this is coming out of my psychological guy
I have this code...
and my console is spammed with the setting score message.. but nothing else.
the result is basically no scoreboard.
and I pass non-null scoreboard name & lines, yet, it still does not work
Hey Guys,
Quick question, since one of the more recent versions of Spigot my EventListeners for custom events that I register no longer work.
I send an event from plugin A, plugin B listens to that event.
I send out the event but it never reaches the listener. If I revert back to a version of let's say the 10th of May it works.
Anyone else encountered this?
not at all
How can I save my banlist to SQL instead of the .json
supposedly spigot wants to enforce some classloading semantics heavier
but i don't know if they've got that underway yet
or if that's related
So multiple servers can share the same banlist
query the db in async prelogin and disallow if the player is in the list
guys dont trust icewaffles
he tried deoping me and stealing my sever
lmao kick this hoe out
why?
ugh
Thanks I'll ask it on the Spigot forums. Not sure how to continue with this.
I would assume other plugins would have the same problem
Dw why, I'm making a spoofing plugin
Sorry, its too probable you are writing a trojan
.-.
How deserialize this?
player.getItemInHand().getItemMeta().serialize()
There are easier ways to do that
For instance overriding hasPermission
Changing UUID is the easiest to impersonate someone and take over a server
Fair
Hey is there a way to make a unique id for any new object in a while loop?
anyone help here?
oh yes i have
Aight show the code where you register the command
Ok so I have this thing here
ArenaConfig.get().getConfigurationSection(player.getWorld().getName()).set("playerLocation.location" + index, player.getLocation());```
and this thing to be able to use it
```java
ArenaManager.setPlayerSpawn(player, ArenaConfig.get().getConfigurationSection(player.getWorld().getName()).getKeys(false). size());```
There are no errors at all but it only seems to do 2 locations only, nothing more. When there are 2 locations, it just changes the last one when the command is executed
How can I upload plugins to Spigot?
Hm okay now send the plugin.yml
okay
You press the big upload resource button
I can't not see it
You literally can't miss it
Can u send a screenshot?
name: RennsCommands
author: renndrew
version: BETA
commands:
discord:
vote:
store:
tip:```
Set all of the command sections to []
to {}
[] is list
Ye my bad
Yes
???
it worked thanks a bunch! :D
Way to change header an footer of tablist in 1.8 spigot?
Packets and NMS
Why would it do more?
can you help with this?
How can I get a direction vector between 2 points
well, note that that would give you the directional vector pointing from location 2 to location 1
I have yaw and pitch of 1 of the locations, but the other location is a block so no yaw or pitch there
Greetings everyone.
Hello.
Do anyone know of sample api code which can store global information?
What do you mean by that.
i want my main plugin to have a listarray of the setting for each plugin.
Sounds creepy
lol thats what i do creepy
Creepy peepee.
lets try putting it like this i got a core plugin and all my other plugins must use the same class with public variables being shared. not a instance of the class in my core
so if i change for example variable lockedbyplug with the plugin name the other plugins must pull that vairiable and also be able to modify that variable
so i want to share variables between plugins
no
First and foremost java is a pass by value language, not pass by reference
ill figure something out thanks for the advice
Because that's what I'm trying to get it to do
^^
How would I make a gui with the same icons.
Same icons?
like there all dirt. but they do different stuff
Fill the inventory with dirt but then make slot based actions?
Does someone know how to use Bukkit#recipeIterator?
[00:05:35 WARN]: [WiiPay] Plugin WiiPay v2.1 generated an exception while executing task 36381
java.lang.IllegalStateException: WiiPayEvent may only be triggered synchronously.
Code to call it:
public void sendEvent() {
this.wiiPay.getServer().getPluginManager().callEvent(new WiiPayEvent());
}
This code is ran in a public synchronized void function.
What's the best way to allow this event from being called in a synchronized function?
Run it sync or?
in a sync function, a runner 🙂
doesn't seem like it...
synchronized keyword won’t make it just magically run on the server thread
so then you're good
I'm aware, I'm recoding a really bad plugin and it's filled with static stuff and stuff like this...
Does anyone know the name of the plugin that allows you to put a message on the middle screen in minecraft?
Wrong channel #help-server
this is #help-development sir
If you want something to run on the server thread then use the Bukkit scheduler
Bukkit.getScheduler().runTask(JavaPlugin.getProvidingPlugin(this.getClass()), () -> {
//call event
});
someone able to help with this?
I don't think that sentence makes sense. Java passes variables either by reference or by value based on type. Complex types will be passed by reference and primitive types will be passed by value.
Wouldn't call it a pass by value language
how do you manage the index you use?
the indexes makes it go location1, location 2
showing one line of code with no other information on how you use or increment the index will not help here
well no shit
?paste so show how you manage the index
then maybe you could show us more so we can help you find the source of the problem 🤯
How can I make sure my built jar does not have a copy of the API?
Skylands:
playerLocation:
location0:
==: org.bukkit.Location
world: Skylands
x: -66.49826835228856
y: 149.0
z: 108.59045268232444
pitch: 4.703241
yaw: -90.78659
location1:
==: org.bukkit.Location
world: Skylands
x: -44.53215050631547
y: 149.0
z: 108.53184486593061
pitch: 1.1401986
yaw: 94.06466
spectatorLocation:
==: org.bukkit.Location
world: Skylands
x: -41.941705808364674
y: 149.0
z: 111.51632777006849
pitch: 1.1401986
yaw: 94.06466```
maybe the location of the config.yml in relation to the rest of the project
No it’s passed by value ALWAYS Garageport.
If pass by reference was the case then this would happen:
class {
int x = 1;
{
System.out.println(x); //1
increment(x);
System.out.println(x); //2
}
void increment(int i) {
i++;
}
}
@oblique ibex
does the onEnable get called?
ok
You mean the references are passed by value?
In that case yes, maybe I got confused by what you meant there
it doesnt even get to saving the config because it has an error instantiating the command class
because you havent saved it yet
oh
yeah that too
order matters
cant try to get the plugin before you set the plugin static variable
No my point is that java is a pass-by-value language which is an irrefutable fact.
Not going to start an argument about this but its def debatable.
When we pass stuff through methods we pass instances, not the pointer/reference itself which is my point and my definition of pass by value
I dont agree with that statement as is. There is a lot to consider regarding heap, stack and primitives. In most cases java is "pass by reference"
You are not actually cloning a part of the heap when passing objects in java but rather their memory address. This might change with stack objects and primitives.
I'm not saying your wrong, but there is a clear distinction between passing object pointers and primitive types. That's all I'm saying.
Although both are passed by value it's still worth mentioning when passing an object the "pointer" is passed.
I don't know the term reference in Java maybe is just wrongly used
Objects are not passed by value in java. An Object that is passed is basically always just a reference.
Yeah that's what I said
Or at least what I meant, I don't know maybe we're using different terminology or something.
Yeah Garage of course but let’s take an example I guess
var x;
void func(Object o) {
}
{
func(o);
}
In the method func only the value gets passed to the parameter as opposed to the reference itself. The reply would demonstrate what I mean with pass by reference.
Yes you're right, but worth mentioning the Object references an address location which does not change when passing. While primitive types allocate a new location. Duplicating the value.
Just worth mentioning I think. We're saying the same thing
Ye
I think I just always "wrongly" called that pass by reference. But I realize that causes more confusion as it is not technically correct.
Anyway improving myself everyday
I mean probably depends on how we define pass by reference/value
Just this shows ambiguity
Well to some degree
I think pass-by-reference will cause confusion among programmers who are used to languages which actually pass by reference
So I think what your saying is definitely more correct. I'll also start using it that way now.
Haha if you think so sure do I mean that’s what I’ve been told and motivated with so that’s why I say it like that.
Hi, how I get the material data to spawn material particles from block crack particles effect ?
I did Material.BLOCK.getData()
But it says that we can't do that
Anyone have any idea how I can start using IntelliJ with the spigot api. I can't seem to get it to work to where I can import what I need.
What are you trying to do
play the block break particle?
I found it ^^
👍
Material#createBlockData()
download the minecraft development plugin, it'll get you set up quickly if you're new
Mmm yea but I am trying to use kotlin not java. It seems like a pain to just swap it all to kotlin.
ah im not sure then
Yea, I tried following several tutorials that lead to the same result in the end. They all tell me to use spigot buildtools or whatever and use the spigot jar in my modules tab on intelliJ
Though I am not able to import anything they are able to import
If anyone can tell me how to start using the spigot api with IntelliJ I would greatly appreciate it.
never had issues with it, if i wanted to develop on 1.8 i just changed the version in pom
First time working with the Spigot API
I have used IDEs before just never tried spigot
I use IntelliJ quite often just this method of importing something is new to me
it still sets up the repo, build configurations, gitignore, plugin.yml, etc.
its a nice plugin to have
I mean I didn't know you could convert to kotlin so I didn't know using the plugin was a viable option
I figured it out using maven.
just saves time especially if you have a lot of projects
I found a thread on the spigotmc site that explained how to do it with maven
ew
your.project.package.Main
THE PLUGIN
You only need main, name, and version
yes
Version is just an arbitrary string too, I'm surprised no one has released a plugin with version potato
mc dev plugin auto generates that for you :c_:
what's mc dev plugin
what is it
damn
they were KICKED
Demeng wasn't?
if Demeng was kicked they would of had their messages removed
it should say his roles if he rejoined
what
Thanks Kyrok for helping me, it made it extremely a lot easier for me to understand how it all works :)
cause he rejoined
what
np
i was never kicked
^
how
you were kicked, maybe your client didn't update..?
¯_(ツ)_/¯
🤷
hes joined now
just do the essay
Student plan I am guessing
and its a nice flex that no one cares about :kekk:
then why are you doing an essay
im in middle school :3
Still a school
if you're in middle school you're still a student 
I was in middle school when I applied for the student plan from github
i dont get the license
reeeeeeeeeeeee
like you have some student id and numver you gotta give em
Apply on github they give you a lot of stuff plus jetbrains products
You can use your student email
no? all they need is your student email
When I applied I had to supply my ID but they changed it now
bet
I would apply for mine but my graduation ceremony is the 20th
kekw
but since im bad at coding i dont need anything like that
gimmie any text editor and im fine lol
Still isn't bad to have
im a bad coder
my guy. I suck at coding and I still applied :^)
what does it benifit me lol
You get a lot of cool stuff
It gives you offers to learn coding
Applied to what
life
The "" condition, oh no!
hmmm thats sus
but its not working
tus bromas no son buenas
when i change to if(player.getname.equals("Developex")){
it works
but the uuid is correct
2 uuids?
you are comparing uuid object to string
read your ide warning
If uuid is UUID, you have to either compare it with another UUID or use toString and compare the strings
ok
you can't use UUID and String interchangeably
XD
Estupido
no hay problema bro 😎 👊
why did it delete my message
tu madre es una perra
#general
no tu
tu madre es un hombre
agarrense a putazos en general
help-development is the "nuevo" general
Spanglish check, uh sorry for ping
Yesseñor
Hello
! I coded nms fake player npc.
but, how can I remove npc from tab? I googled, not solved. connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, npc)); it removes npc's skin 😦
Bukkit.shutdown()
hmm are you saying to me?
or nah?
bruh Shutdowns the server, stopping everything.
xD
Hmm
i mean, his method works does it not
it removes the npc from tab 👍
it shutdowns server ;-;
yes but it removes the npc from tab
@quaint mantle did u actually try that method
i mean the thing is literally in the name
Bukkit -> shutdown
shutdown bukkit
so your problem is solved
what
it shutdowns server
don't joke me please
hello
any1?
can any1 help me with maven project?
whats the issue?
pom.xml
okay..?
i need to complie a plugin passed for me by a partner
can u guide it for me with IntelliJ
that guide was for IntelliJ
tf
tf
add that dependency into your pom.xml, and click that elephant on the top-right
oh
i thought you wanted to compile ap roject
welp no nitro = blind
so another reason to gift me :3
btw whats with your yt channel
why is the class name lowercase, triggers me
hacked
noob mistake
when i just start4ed using java i did that too since i was used to naming all methods and stuff lowercase and never had to use classes
ok
dont remember where i do that lol
shuut
classic?
shot
org.bukkit
idk
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
</dependency>
use this one https://www.spigotmc.org/wiki/spigot-maven/
oooh
just change the version
ok
You’ll need to use spigot instead of spigot-API for NMs
Which requires you to run buildtools
yes that explains it now we know how to solve your issue
https://pastebin.com/CN5cUy46 I cant figure out how to get this command to work, i am new to spigot / bukkit plugin development. What the plugin is supposed to do is on command execution give a player a book that gives details about the server and delete any duplicate books that they might have of it from there inventory. All i know is that the error is happening past line 46. can someone please help?
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.
Ah yes “the error”
if any1 want to help, DM me
also welcome is spelled wrong
you haven't asked for help
you can run it on mac
u know that I'm using very ancient version of IntelliJ breh
and that does not make a difference
some libraries are messing itself up
if you want to compile the fucking plugin, you need to stop making excuses and run buildtools
ok
Caused by: java.lang.NullPointerException
at me.halfbrau.playerwellcomemessage.AboutServerCommand.onCommand(AboutServerCommand.java:56) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-1.16.5.jar:3074-Spigot-9fb885e-b1064
Something is null on line 56
This is a case where spigot has null instead of air
thank you!
Welp that didn't work. How many ways are there to check if a player has an specific item in the're inventory?
you could loop through and use isSimilar
isSimilar should work well here
if (item.isSimilar(targetItem)) assuming neither is null
(or can targetItem be null? idk)
it's nullable
nice
sounds good i will try it
elite solution would look something like this
if (Stream.of(player.getInventory().getContents()).anyMatch(targetItem::isSimilar)) {
//they have the item in their inventory
}```
Can someone tell me how exactly I use this API? https://wiki.bg-software.com/#/superiorskyblock/missions/.
I'm trying to create a new mission and I don't know how the jar should be build.
The mission jar.
I imagine you can build it however you want
Like, do I need class that extends JavaPlugin or something like that?
I have no clue xd.
alright, thanks.
Ive never really used enums so where would a good place be to put the class with the enum inside?
inside the main class? create a new packet for enums?
is there no PrepareGrindstoneEvent?
what do you mean by this
usually enums have their own class, or if they're small enough, within the class they're used the most
Hello
! I coded nms fake player npc.
but, how can I remove npc from tab? I googled, not solved. connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, npc)); it removes npc's skin 😦 thanks you for share 😄
Pretty sure things have to be in tab to have a skin
Only way around that is to have a full custom tab list
Hey Guys,
Quick question, since one of the more recent versions of Spigot my EventListeners for custom events that I register no longer work.
I send an event from plugin A, plugin B listens to that event.
I send out the event but it never reaches the listener. If I revert back to a version of let's say the 10th of May it works.
Anyone else encountered this?
https://pastebin.com/34N2HUMD "Name cannot be null" can someone point out my mistake ? 🙂 thanks!
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.
you are doing item.getString("Name");
but doing nothing with it
also itemM.setDisplayName(key);. Key can be null iirc
I'd guess you want to listen to the ProjectileHitEvent and check if the arrow hit a block by null checking https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/ProjectileHitEvent.html#getHitBlock()
declaration: package: org.bukkit.event.entity, class: ProjectileHitEvent
respectively remove the arrow then
okay and is there a plugin for it already by any chance?
ty
if I keep track of my own projectiles (which are just objects that move an assigned entity every tick and do their own collision checks), will I have to worry about the world unloading?
i.e. what happens if a world unloads and I try to move an entity in it (that I have saved as a reference)
you're gonna leak the world is what
or if I try to call something like getNearbyEntities or getBlock in a world that got unloaded
they only persist for a short amount of time, is it still a problem?
so I guess calling those functions force-loads the world?
or at least stops it from unloading
I honestly have no idea what it'll do
hm okay
might just listen for world unload and delete all projectiles if it happens
you might wanna use ChunkUnloadEvent
not all chunks are loaded when the world is unloaded
does a chunk unloading mess up entity references?
so removing entities at the world unload point does not guarantee a full removal
Yea
the entity reference won't point to the correct entity after a chunk was unloaded and loaded again
what about just checking if the entity exists and, if not, despawning the projectile?
or is there no way to know if a reference has been corrupted
thanks you!
I mean, your old reference still has the uuid of the entity
which you could use to re-fetch the entity
I think isValid ye
declaration: package: org.bukkit.entity, interface: Entity
I mean, your issue is that if the entity is invalid (because chunk unload) you can't remove it anymore 😅 its already too late at that point
nah I only need to remove my projectile
which is not physical
I just remove it from a list in my projectile manager
and GC eventually kills it fully
Guys, quick question, i need to put a try catch inside a run method of a Consumer<?> anonymous class. The problem is that the run method is ran multiple times inside a loop, is this a problem?
if you're asking in terms of performance it's not the best but it shouldn't be a major issue
if you're asking in terms of logic, it would depend on how you expect it to run
No it isn't actually a problem. I was wondering about the performance.
handling exceptions is slow, but the existence of a try catch by itself isnt
ok, thanks.
How to hide nms entityPlayer from tablist? but I don't want to useconnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVe_PLAYER, npc));
you have to if you want a skin
and honestly just use citizens
or some other npc api
hmm 😦
is boundingBox.rayTrace very expensive?
don't think so. Should only contain a single square root and the rest is all straight up comparisons
okay sweet thanks
is projectilelaunchevent called before the item is thrown
after
EntityShootBowEvent is called prior for bows
I think the paper fork provides PlayerLaunchProjectileEvent
it is called before the projectile is spawned
but the item is already consumed at that point
hey how would i get a random coordinate on the ground?
use the Random class
how would i get it on the ground?
not yet
use the bukkit scheduler
yes
hello so im super confused with bukkitschedulers
this is what i have for TasksBukkit: https://paste.md-5.net/yifupowanu.java
Supplydrops: https://paste.md-5.net/irezigiput.java
it doesnt seem to do anythingh
It won’t fire during the enable process also
Yea but he’s scheduling it to run the next tick
a timer
Yeah
Do you know what the delay is here?
It does, but then it'd run a second time after 5 secs
Precisely yes
hELLO
Anyways my point is that you’d just call BukkitRunnable#run if you wanna call ur task right in spot
o
Also for finding a random spot you'd have to use a recursive function that would search for a suitable block to be placed on
oo okay
I'm making an NPC plugin. And I want to make various entity types. And I think we should use pathfindergoal to make NPC. If so, do I have to create one class for each entity? (extends EntityEntity)
would that be hard to do?
Not really
Depends on the use case
o
Supply drops, right?
I think each type needs a separate class uh might be wrong here but yeah
Where do you want them to spawn?
i want them to spawn in random places around the map
but not like in buildings or anything
If you want them to spawn between 2 locations ( inside an area ) you should use some math to get random x, z inside that area
okay
otherwise you can use a random number to find the x, z in radius
like -1000 & 1000
so that the random number would be between those
yeah
Then just #getHighestBlockAt
and check if it's a suitable block and other things (are there claims or other regions like spawn at that location) etc.
okay
hey so with the random thing, i decided i'm going to have set locations instead, how would i only put randomLocation once or like what should i do?
"275, 84, -181",
"185, 74, -247"};
Random r=new Random();
int randomLocation=r.nextInt(arr.length);
Bukkit.broadcastMessage("§cSUPPLY DROP AT: §7 " + (arr[randomLocation]));
Location loc = new Location(player.getWorld(), randomLocation, randomLocation, randomLocation);```
ideally read a string list from the config and precompute it into a location list, and then pull a Location from a random index
You could also create a custom LocationList class and let it implement Serializable so you can just save/load it directly to/from the config.
But then user written configs will be more complicated.
How can I change the skin of an EntityInsentient?
what do you mean exactly?
And how can I spawn it lol?
I'm trying to make an NPC based on a player, and I'm trying to make it move
ah, it looks like EntityInsentient is NMS
Yeah it is, am I not meant to ask it here?
no you can
I figured that much
EntityInsentient does not necessarily have a skin. Thats specific to a players profile.
And EntityPlayer nor EntitiyHuman are instance of EntityInsentient.
I see, so how would you recommend making an NPC from a player and making it move?
basically you have to fuck with the protocol
and skins are cancer
pretty much no matter how you do it you'll end up with intermittnely flashing names in the playerlist
Setting the skin is quite easy. You simply get a Skin and its token then set the property in the GameProfile of the EntityPlayer you are about to spawn.
generally though you probably want to preserve your sanity and use some npc library or api
for whatever reason player events dont get called for interacting with air?
Yeah I've done that before, but is it possible to move an EntityPlayer without teleporting it?
yes
And by that i mean skin and signature
I have no regards towards my sanity
PacketPlayOutRelPosition
implement proper ai goals for it
or something like that
Alright sounds good, thank you much!
One last thing actually
How can I set pathfinder goals to it?
EntityPlayer does not have any ai goals or pathfinding
you can still set them though
if all else fails you can extend and implement it to have them
ohh air events are always cancelled
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
hmm
i didnt type to the end
How do i do:
To damage player if he stands on grass
Itz all
PlayerMoveEvent -> check Block player is standing in (But this only applies when he is moving)
Scheduler -> check every N ticks if players are inside a grass Block.
ok thx
You could do that with an evenly distributed scheduler.
what is scheduler
is there a way to check every tick if the player is holding down RMB? The use event doesn't fire every tick
A construct that schedules actions for a later point in time. Possibly repeatedly.
Ok
the use event is fired when the interact packets are received
there is no good way of knowing whether the button is held down or not
Track packets
the client simply doesn't send that information
so there isn't a way of telling if I hold RMB for 1 tick vs for say 3 ticks?
there is not, no
the client simply sends an interact packet every x milliseconds while the button is held down
there is no "button down" & "button up" information in the protocol
And the precision is based on x
so if I want a weapon that shoots 10 times per second it has to always do bursts pretty much right
So you can check every n ticks if the packet was sent again. If not then he released the button.
Yes. You will always fire 2 or 3 more shots after a player released the button.
you'd have to track interact events or packets and keep shooting until the time since the last one exceeds x milliseconds
which would end up in you shooting a couple more rounds even after the button is lifted
ideally you'd make it configurable as it might change in the future
assuming reasonable connection
as for what the current interval is, dunno, half a second should probably be fine
okay so I did some testing
if the player isnt moving their head I get 4 ticks (on localhost)
sometimes goes down to 3 and sometimes up to 5
when moving the head its either 0 (I assume if we click multiple blocks in one tick) or 3-5
could you give the player a shield and check if they're blocking?
that would be kinda obtrusive no
if it's a gun or something you could just make your guns be shields and add a custom model to them via a resourcepack
though that might get weird if the player is holding a shield in both hands
if input packets are only being sent so infrequently then wouldnt shields have the same problem?
no because the server's notified when the player shield/unshields
no because shields actually do have a "put up" and "put down" information going in the protocol for them
ah i see
same with bows I think?
ig that would work but then youd always be slowed down when shooting
and have more defence
you could be super creative and give them speed/increase their walk speed while doing that
hm maybe shield speed/def are configurable?
use bows
that way you won't run into the protection issue
you'll still have to modify the player speed though
can you cancel a bow pull?
you can cancel it being fired yes
although you will need arrows in your inventory to pull it
even with infinity
so i guess that's cancer too
can't just reskin arrows as bullets?
check every 6 ticks and should be g
could but then what if your gun has a full mag but youve got no more bullets in the inv
Take a look at what i came up with using ProtocolLib:
https://gist.github.com/Flo0/302f7eae875e5dd990f66cdd58de7087
you could, uh
use potions
if you can cancel the sound that should be fine
not sure if it's clientside though
or snowballs?
i would think the same as potions
I see the a problem in this implementation.
i don't think they're thrown each tick
but they might be more rapidly thrown than regular interacts so ig that'd be slightly better
How do i check what block is under player?
What i have now
get the block under the player and get its type
what api method
get the player's location
move it 1 block down
get the block at that location
get the type
interesting, this isn't a tick-precise solution though right
Get the Player -> get the Location of the Player -> get the Block of that Location
realistically I doubt players will notice/care about tick precision
It also has a logic issue.
ok ty
okay thx
will server lag with that