#help-development
1 messages ยท Page 1366 of 1
So if you pass a fake uuid it returns the uuid instead of the player?
No?
An offline player will always be returned regardless of the uuid
I believe the docs for Bukkit.getOfflinePlayer mention this
So how do I check if an OfflinePlayer exists or not?
Like it is actually a player.
An OfflinePlayer will exist for all uuids and names I believe
Is it possible to get the slot that an item will be put into from the EntityPickupItemEvent
I need to check if when a player picks up it is going to their main hand
Save the item in the pickup event, check their inventory like a tick or 2 later, check to see if that item you saved is in their main hand
Ahh, ok
You could use a runnable in the pickup event actually: Bukkit#getScheduler()#runTaskLater
Donโt even have to save the item
Hello! I'm using this code to create a custom YML file.
public File rankYML = new File(getDataFolder()+"/ranks.yml");
public FileConfiguration rankConfig = YamlConfiguration.loadConfiguration(rankYML);
public void saveCustomYml(FileConfiguration ymlConfig, File ymlFile) {
try {
ymlConfig.save(ymlFile);
} catch (IOException e) {
e.printStackTrace();
}
}
I also this in the yml file,
enabled: true
But the default custom yml file text doesn't seem to be copying into the file
It just generates an empty yml file called ranks.yml
is there a way to identify when a player has the tool date changed?
tool date?
Why would you be able to use /give
uh don't follow that
Find someone else
can reviews from banned users be removed?
uh #general Auxilor
Should this work: Bukkit.addRecipe(newrecipie);
Yes
k just checking
._.
where is the scoreboard stored? (When you do /scoreboard)
i mean when the player's tool has its name changed
You can detect anvils but don't think there's a good way if other plugins change it
No error, but the command doesn't register. Command: https://paste.md-5.net/etowurisek.java
Why do you want a command to add a hard coded recipie
Also you didn't send the code where you registered it
You should also checked if you registered it in the plugin.yml
wdym
It registered
like when i type the command in minecraft, it says Unknown command
Looks like you didn't add it to your plugin.yml
And now where did you register it
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
EntityPlayer knockedEntity = ((CraftPlayer) znokautowany).getHandle();
knock.setGameMode(GameMode.SPECTATOR);
knock.setSpectatorTarget(reviever);
knockedEntity.playerInteractManager.setGameMode(EnumGamemode.ADVENTURE);```
Does anyone know why when to execute this code, when this person (knock) right clicks it, it crashes for "cannot interact with self"?
Send the full error
c++ more like shit++
This is a cause the kick player
This is nms
doesn't look like you need NMS to do that though
IS there like a ItemStack#setMaxStackSize() method?
https://sourceb.in/mdnqwoWRUC - it doesnt spawn the item at the exact location, it spawns the item offset of the location, I tried dropItem and dropItemNaturally
heres some referance, that paper did not spawn at the golden block, it spawned near it
Main.java:
@Override
public void onEnable(){
new CreateRecipieCommand(this);
}
Still doesn't work
add 0.5 to x and z
y?
does anyone know if spigot/bukkit stores a copy of the players gameprofile somewhere?
and uses that when executing commands?
adding 0.5 to x and z gets the center of the block, Location#getX() and Location#getZ() on their own will get you the very corner of the block
loc.add(0.5, loc.getY(), 0.5);
plugin.getServer().getWorld("world").dropItem(loc.set(loc.getX(), loc.getY(), loc.getZ()), paper);``` like this?
oops
loc.add(0.5, loc.getY(), 0.5);
plugin.getServer().getWorld("world").dropItem(loc, paper);```
this.getCommand("createrecipe").setExecutor(new CreateRecipieCommand()); gives error: The constructor CreateRecipieCommand() is undefined
What am I doing wrong?
i believe that should work, although you dont want the Y location to be double itself, so just loc.add(0.5, 0, 0.5)
You didn't follow the guide
did not do anything
same thing
drops it offset
even tho I have .dropItem
how do I fix this?
ye
press "more"
and its throwing an error ingame
so you are having an error but wont post it here?
How can I do so that if I break dirt I get 4x dirt instead of 1
he needs because he wants the player to have an observer and at the same time be a passenger of the person he announces
the code that you sent has 0 chance throwing that
nothing that woulkd throw it
send it anyway
Error with bracket which is up return false;
player.getInventory().addItem(houseHandler.makeItem("Basic Home"));
any fixes?
item pickup event
That's an error you should be able to fix yourself. No need for us to do it for you
but that is dumb cuz if you drop items and then pickup you get more
i just don't get why it says that its error...
You have too many }
you can also try setting the velocity of the item to 0
item.setVelocity(new Vector());```
lol
I am currently changing a players GameProfile name, but when I do /gamemode 1 NewNamedPlayer it says the player cannot be found, why is that?
can someone please help me, this should not be throwing but somehow it is
what's funny?
Can i make a block have no hitbox, i.e you can walk thru it but still has the texture?
It will have to be an entity
whick version are you on
the closest you can get to that is fallingsand
latest
that that person had to many }
you might need to /gamemode creative
because gamemode 1 is on older versions
Yeah, that makes sense, thanks anyways u two @chrome beacon
the command itself works fine, it's just a problem with spigot i think
No it's 99% your fault
try Ctrl+Shift+O
defo you
okay well I tried doing ````/gamemode creative NewNamedPlayer```, no luck
We can't really help you without your code
but you can help me ๐
no code is needed
@minor fox #help-server
bruh this is a dev related question
He's modifying the GameProfile
I change a game profile field, and it's not recognized when using comamnds
But not showing us how
well then we need code
m8 do u want help or not
if that command don't work then the game profile don't work
๐
worked ty
The thing is, Player#getName returns the new name set in the game profile, so surely something's not wrong on my end when /gamemode doesn't work?
u fix it by cleaning up ur code
does it work without the changed name?
yes
then it's ur fault lol
still same things
plz ๐
send ur "clean" code
not necessarily, spigot might perhaps store a copy of the old game profile somewhere that doesn't get updated when executing spigot commands
....
that's what I am trying to figure out
how to clean then -_-
remove the nesting
tf does that mean
bruh
hey
hi
so
code
if (args.length == 0) {player.sendMessage(usage()); return true;}
if (args.length < 1) { player.sendMessage(usage()); return true; }
error
what happens if i set short damage or byte damage to 0 in the ItemStack contructor
Try and see
hopefully
anyways fixed it
nothing
aight but please still remove the nesting
what is nesting...
idc about brackets i just need code to work
ur gonna have to...
very funne
veri
PLEASE
๐ฟ ๐ซ dont make me
no
Well why u shoot doggo
there
Gonna need to see a bit more code than that chief
like line 26
Player player = (Player) sender;
doubtful that that's actually L26
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
at me.zoibox.houses.commands.GiveHouseCommand.onCommand(GiveHouseCommand.java:26)
Do you check instanceof?
Doesn't really matter, he needs to do the check much earlier.
But even so the second check is still redundant and thatโs an irrefutable fact
that would be pretty great
If it can have damage, yes. If it can't, it'll attempt to load a texture for it. If you have a texturepack for that, it can be used for that, otherwise you're gonna have a big purple blob
ooh rip
Alright. So i just made this tool to visualise the PerlinNoiseGenerator of Spigot:
I need the second one
incase people do /givehouse sdfkj lskdfj slkfjslk fjsf lksdjf lsdkfj sdkl jfds
when would it be useful tho?
jw
Nice
omg it works
Its for Jadss_pt because he wanted to get into world generation and didnt quite understand what those values meant.
tysm doggo I will never shoot you
Does anyone have some experience with the inner workings of spigot/bukkit?
But it still does not answer why the 3 values are the same ya know?
why
wdym?
ah ok
the question should be pretty straight forward?
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.
They probably come from the same seed (So the same generator instance).
Uhu
I have already asked the question though
i mean excactly what?
How would all of them be the same then...
It only changes based on octave and amplitude.
Ill just send you the tool then you can play around with the values
Uhu OK
Hey, I have a bit of a predicament. I have a class that extends ItemStack. It can be different materials, but mainly a stained glass pane. Since the super call has to be the first statement in the constructor, I can't check if it is a stained glass pane and color it using a different contructor. How do I solve this?
Why would you even extend ItemStack
My question is why is it that after changing the GameProfile name field, /gamemode <mode> NewName returns with a "that player cannot be found"?
It has some other info that can be parsed as well, and makes it quicker to create new rewards in my system
omg just show code
what code do you want sir
the class u keep saying throws errors
the code that I know is working correctly?
yes
you can decompile spigot and see what it does when you are doing /gamemode name
Just do the check after the super call and change the type accordingly then? You're still in the constructor so it shouldn#t really matter
I did, and I found that the GameModeCommand class is infact getting the target by getPlayerExact, so the error lies there I guess
How do I change the color after?
There's no non-deprecated way of doing that i don't think
pre or post 1.13?
pre
then make you're name changer change getplayerexcact?
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.
the field in the game profile is updated and Player#getName returns the new name
/gamemode <mode> NewName returns "player cannot be found"
then it's youre shitty code
stop asking
but /gamemode is a spigot command?
bro
no it is vanilla
so bukkit?
stop protecting ur fbi files
this.durability = ... should work, no?
just give it
@crude charm what code are you asking for really
the whole class
but it's not spigot's fault. Spigot is not made for your name changer thing
there is no class
????????
??????????
What about things with actual durability though
lmfao what
?!?!?!?
No need to be rude
i obviously have that but the only relevant thing in that class is the game profile changer method
Swedish?
yes
Letโs go
@crude charm private void sendEntityDestroyPacket(int entityId, Player... exclude) { sendPacket(new PacketPlayOutEntityDestroy(entityId), exclude); } do you find this code useful for helping in this case?
no
if not, then you don't need the whole class
r u stupid?????????
the rest of the methods in that class has nothing to do with any of this
ive never laughed so hard at 1am after being up at 5am for the last week
Jesus Zoi you gonna stop being rude or what
that don't have that either
rfsdlgdfg
sowwy
what is that supposed to mean
????? what is this supposed to help us help you #help-development message
Well I've given all information I possibly can
?????????
bro
then we can't help you
I'm gonna give you guys the class, but it's not fixing anything
@earnest junco What about things with actual durability?
yes pls give class so we actaully can help you
lol
but im tired of you so maybe i won't help lol
How do I set the color on an ItemStack pre 1.8 that can have actual durability after it is already contructed
dont use pre 1.8
use 1.8
or 1.16
I meant 1.8
(short) value
wdym
does anyone have a hastebin I can use
After the ItemStack is created
cant upload this
how do I set the color
???????????
"error adding document"
?bin
?paste
error with my brain after all of this
lmfao
my brain ded
@burnt totem @crude charm make me proud https://paste.md-5.net/ropoyokowo.java
lmao
What did you expect?
Get the MaterialData, check if its an instanceof Colorable and then do the color funkiness
ty
we'll see about that
yeah try it yourself
so what is throwing errors again
if the command don't work then you're code don't work....
ikr
Wait, sorry. Color funkiness?
oooh
nvm
lol
is there an event that is called when nametag is showed or something? in bukkit
sorry, do I just get the data, cast it to colorable, and then set the color? or do i have to do that to the data THEN set the data on the item?
No, you can get the data and check the instance to see if it can have a color. Which is what you wanted, right? Then you can still set the new color in whichever way you prefer. Whether via durability or MaterialData.
I had debug messages but reverted to an old version to see if that would fix it but it didnt. if arg1 is not equal to an item in a list it should print a list but instead it prints the usage. my debug message went off fine for the other args but this one none went off
ok
I found out something
one sec ill try to fix it
nvm
it didnt fix it
but
its this
if (args.length == 0) { player.sendMessage(usage()); return true; }
if (args.length > 1) { player.sendMessage(usage()); return true; }
something to do with that
how old are u lmao
why you ask lol?
most people don't say it like that if they are 13+
they say I gotta go do something
and they wouldn't be on discord 5 minutes before
whatever
im 14
;D
@sleek pond can u plz help me
idk if porting a project to an older version is a good starting point
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.
I did
here
@crude charm @burnt totem we're not done here. nothing is throwing errors
huh
can I send pictures in this channel somehow
if (args.length == 0) {player.sendMessage(usage()); return true; }
if (args.length > 1) {player.sendMessage(usage()); return true; }
shows the usage for any command invocation with anything but 1 argument
the latter?
I mean, that is the upper bound yes
what
why not just return the method
I want it to show it for anything more then one like if they do /givehouse sdfg sdflkj sjlks jflkdsj flsdkjf slkfj sdlkf jsdflk sjdfl ksdjf lksdjf sdlk fjsdlk j
but you are talking about two arguments
yea I have 2 args
private boolean sendMessage(CommandSender sender, String input) {
sender.sendMessage(input);
return true;```
but your command only allows invocations with 1..
is that not starting from 0?
then you can do return sendMessage(sender, usage());
oh
["hello", "there"] would have arr.length == 2
with arr[0] == "hello" and arr[1] == "there"
when it switches like that
@crude charm could you try to edit the players game profile and see the strange behaviour yourself?
working on smth else rn
@eternal night now its sending both
?
if (args.length == 0) { player.sendMessage(usage()); return true; }
if (args.length > 2) { player.sendMessage(usage()); return true; }
oh wait
thats just me
or
wait
nvm
nbo
fixed it
tysm
โค๏ธ
๐จโโค๏ธโ๐โ๐จ

๐ฃ
pretty sus indeed
ikr
Do you have a couple of minutes now zoi
after I fix this
this line: this.getCommand("createrecipe").setExecutor(new CreateRecipieCommand());
gives me this error: https://paste.md-5.net/ecawahacax.cs
command is probably not defined correctly in the plugin.yml
yeah
recipe and recipie. How do you spell it in your plugin.yml?
Hi, is there a way to know in which slot a picked up item is going to go ?
@EventHandler
public void InvClick(InventoryClickEvent e) {
if (e.getView().getTitle().equals(ChatColor.GOLD + "List Of All Custom Crafts!")) {
Player player = (Player) e.getWhoClicked();
//Determine what they selected and what to do
switch (Objects.requireNonNull(e.getCurrentItem()).getItemMeta().getDisplayName()) {
case "Raw Rabbit":
player.closeInventory();
player.sendMessage("testing");
break;
case "Raw Mutton":
player.closeInventory();
player.sendMessage("testing1");
break;
case "Raw Porkchop":
player.closeInventory();
player.sendMessage("testing2");
break;
default:
break;
}
e.setCancelled(true);
}
}
}
could someone tell me what im doing wrong? i dont get it
the display item of the clicked item are those
its not closing inv either so its not fulfilling the condition
HumanEntity.closeInventory()
HumanEntity.openInventory(Inventory)
HumanEntity.openWorkbench(Location, boolean)
HumanEntity.openEnchanting(Location, boolean)
InventoryView.close() ```
Because InventoryClickEvent occurs within a modification of the Inventory, not all Inventory related methods are safe to use.
i guess
it still goes to default every time
@EventHandler
public void InvClick(InventoryClickEvent e) {
if (e.getView().getTitle().equals(ChatColor.GOLD + "List Of All Custom Crafts!")) {
Player player = (Player) e.getWhoClicked();
//Determine what they selected and what to do
switch (Objects.requireNonNull(e.getCurrentItem()).getItemMeta().getDisplayName()) {
case "Raw Rabbit":
player.sendMessage("testing");
break;
case "Raw Mutton":
player.sendMessage("testing1");
break;
case "Raw Porkchop":
player.sendMessage("testing2");
break;
default:
player.sendMessage("test");
break;
}
e.setCancelled(true);
}
}
}
sysout your Objects.requireNonNull(e.getCurrentItem()).getItemMeta().getDisplayName()
I mean, a normal unchanged Raw Rabbit item does not have "Raw Rabbit" as its display name
if that is what you are trying to do
I'd use Objects.requireNonNull(e.getCurrentItem()).getType()
switch (Objects.requireNonNull(e.getCurrentItem()).getType()) {
case RABBIT:
player.sendMessage("testing");
break;
like that?
You can do that for fail safety but it will still spam exceptions in your console.
yea this is working
and i dont get any spam
in console
idk whats wrong with display name
Do a proper null check before the switch case.
Of the ItemStack, its ItemMeta and if the meta has a display name
And this looks like it should be done using the Material and not the display name of the ItemStack
Better to not use the name at all. Material match
^
Anyone has an idea how I properly reset blocks that I changed with a MultiBlockChange packet? I want them to be "synced" with the server again. I thought about sending a MultiBlockChange packet again like so:
WrappedBlockData.createData(world.getBlockAt(location));```
but it gives me NullPointerExceptions. To set my blocks, I used ```java
WrappedBlockData blocker = WrappedBlockData.createData(Material.STAINED_GLASS, 14);```I know this method is deprecated but I couldn't figure out how to pass "red stained glass" in 1.12.2
you store teh locations you fake changed. then send a new fake update with location.getBlock().getBlockData()
I've been reading about the flyweight pattern (https://en.wikipedia.org/wiki/Flyweight_pattern). From what I've learned, you can effectively only store one instance of each class, no matter how many times it's instantiated, correct?
Well, would you be able to apply this to, say, AxisAlignedBB in NMS? Or is it already in effect? I haven't taken a look at the code yet; I just saw JProfiler report a lot of instances of it. I'd think (most) blocks would all have the same bounding box, and hence be able to share one instance of it. Entities as well, say you have a bunch of rabbits; they could all just share a bounding box.
That is, assuming AxisAlignedBB doesn't store locations. If it does, from my knowledge, that all goes out the window.
Hello, somebody know an good API for easier make configuration (like annotation or something else) ?
.getBlockData() does not exist in 1.12.2 ๐
Good luck with that then
in 1.16 its player.sendBlockChange(loc, loc.getBlock().getBlockData());
No clue on 1.12
HCH
somebody on paper discord have said https://github.com/A248/DazzleConf
dazzle isn't bad
i ask before before i have use Yamler but this is no longer supported
I just prefer HCH
gotta love discord
what about it
the upload files thing
oh yeah
that's all I got
can I catch it?
Show full error, there is none of your code mentioned there
?
I show all my code
and the full error
oh hold on
its from something else
I thought this was a separate error
sorry
this is the issue
try (EditSession editSession = WorldEdit.getInstance().newEditSession((com.sk89q.worldedit.world.World) world)) {
me.zoibox.houses.utils.SchematicUtil.loadSchematic(SchematicUtil.java:41
ik
that's a worldedit bug
ClipboardFormat format = ClipboardFormats.findByFile(file);
its its latest ima cry
public void loadSchematic(Player player, String schematicName){
Location location = player.getLocation();
WorldEditPlugin worldEditPlugin = (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit");
File file = new File(worldEditPlugin.getDataFolder() + "/schematics/" + schematicName + ".schematic");
Clipboard clipboard = null;
ClipboardFormat format = ClipboardFormats.findByFile(file);
try (ClipboardReader reader = format.getReader(new FileInputStream(file))) {
clipboard = reader.read();
} catch (IOException e) {
e.printStackTrace();
printConsole(CC.RED + "An occured whilst loading ");
}
EditSession session = worldEditPlugin.getWorldEdit().getEditSessionFactory().getEditSession(new BukkitWorld(location.getWorld()), 10000);
try
{
World world = player.getWorld();
try (EditSession editSession = WorldEdit.getInstance().newEditSession((com.sk89q.worldedit.world.World) world)) {
Operation operation = new ClipboardHolder(clipboard)
.createPaste(editSession)
.to(BlockVector3.at(player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ()))
.build();
Operations.complete(operation);
}
} catch (WorldEditException e) {
printConsole(CC.RED + "An error occurred whilst loading the schematic!");
e.printStackTrace();
}
}
which is line 41?
ClipboardFormat format = ClipboardFormats.findByFile(file);
You might be linking against outdated version
WE jenkins afaik
beep
Downloads and builds for the WorldEdit project. Download beta and test builds!
I'm trying to edit the DedicatedPlayerList so that Bukkit#getPlayerExact returns the player after their GameProfile name attribute is changed. Which fields do I need to change?
boop
will WorldEdit Build #5758 work for 1.8?
The JVM GC is optimised at creating a lot of instances
update minecraft
not my choice
Attempting to cache as much as possible may be counterintuitive
I believe thats not possible considering the server only knows the name of players that logged in with that name
^^ yeah, the GC should hopefully be able to handle it. The other question would be, why not just reuse the ones already existing. Most AABB that are created are there just for the API
internally most of the instances are grown to their respective sizes
instead of re-created
in just the spawn chunks it's 417kb of ram for BBs so u right
it is possible, that's why I'm trying
AABB was a bad example but the question is still valid
Excessive object creation is either a bug or something bigger of an issue
but what else to use it for xD
Use your brain
Basically, remove it from the try clause
plenty of other things I can't think of, otherwise it wouldn't be a design pattern
or it would but like
Use Java 1.1 syntax
Say I add a new key to the default config.yml in a later update (v2.0) that wasn't in v1.0, how do I make it so that this key is added to existing config.ymls once a user upgrades from 1.0 -> 2.0
By default because a config.yml exists it won't modify it or copy the new default
I can think of dirty ways to do it but just wondering if there's a better clean way
right right but that was just an in-minecraft example
Yeah the pattern definitely has uses
From what I've learned, you can effectively only store one instance of each class, no matter how many times it's instantiated, correct?
this question at least
java's int cache for example kinda falls in there
How can I do to set an item in the player's inventory when he enters the server?
oh?
PlayerJoinEvent, Player#getInventory()#addItem(ItemStack); make sure the inventory isn't full as well
so,
Closable c = null;
try {
// stuff
} catch (Throwable e) {
// ignorew
} finally {
try {
c.close();}catch (Exception e) {}
}
@crude charm
I mean it caches small integer numbers and returns the same instance so you don't re-create them so often
Thanks
lol
Not in most minecraft instances without basically ripping performance away
if it's closable why not just
try(closable declaration){
stuff
}catch (Throwable e) {
}
As that would negate any caching
It has to be auto-closeable for that iirc
Actually, I might be wrong there, but what can I do if he provides fundamentally bad code
this is hurting my brain
ah
it was fine before
How could I have it set at a specific place in the inventory?
?jd
package index
Because you are linking against another version
probably #setItem(Integer, ItemStack) but I gotta check
ABI is not guaranteed to stay the same across versions
declaration: package: org.bukkit.inventory, interface: Inventory
yep
keep in mind that slots are weird
Or better said, it should break across versions, especially major versions
This is an instance where it broke
can't wait for all the spigot 1.17 breaking changes ๐ฅณ
probably won't be many
I mean, we will see :>
https://www.spigotmc.org/threads/ask-how-to-add-new-values-in-config-yml.323167/ is there. abetter solution to this?
MD_5 has been doing his best at protecting ABI in the last years, I would be suprised if that would change so soon; but then, one day all the old code needs to be flushed down the drain
depends on how aggressively our Canadian choco is gonna push #576
world will defs have a few breaking changes but I doubt it'll be that bad
what's ABI
ah
hope it's done in 1.17 tbh
would be great
same ^
Probably the legacy materials can be flushed, don't know more things
The material concept might get changed, but that would require some serious refractors
imagine if they used a different command framework
what are y'all's opinions on that
I mean craftbukkit compatibility layer mayyyy be able to provide help
I personally wouldn't mind a whole lot but it could defs use improvement
what is that?
I believe that bigger changes to the command API structure are not needed
indeed
yep
.setLore(Collections.singletonList("ยงfa"))```
How can I make more than one list?
If you want more elements use arrays.asList
Ok, thanks
Hi, I'm trying to do entity.remove()
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.
But it doesn't show up in EntityDeathEvent
just testing
Why doesn't it?
@leaden falcon removing an entity doesnt kill it
And is there an event I can use for it?
@fading lake Oh, is there a way to listen for removals then?
thats not how you kill an entity
try setting its health to 0, that should do it, OR manualy fire the event yourself
There's no EntityRemoveEvent?
no, the remove function completely deletes its existence
Alr
Do you mean entities being killed or actually removed from the world?
hes using Entity#remove
yep, just wonderign what his intention is
does anyone have an example of a command that opens a gui with items that open guis, with more items where each one opens another gui?
I just wanna listen to when an entity dies/removed
Making a special entity
sometimes I remove it .remove()
but other times the player kills it
and i wanna listen to both
create a gui wrapper
Death is monitored in https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityDeathEvent.html
@leaden falcon when you remove an entity (before you do it), fire the EntityDeathEvent yourself (cant remember if its cancellable, but if it is, prob best implement that too)
that's what id do
not exactly hte best way but eh
hm didnt know that exsited
But which method do I use to make more than one?
singletonList?
emptyList?
I gave you a link that showed both
Arrays.asList("Hello", "greetings", "whats for dinner");
Thanks ^^
For an last question, what i can use for an good command framework, i have see ACF (from Aikar) and CommandAPI but i want have yours opnions and if some other tools exist.
ACF by Aikar is good for starters
Make your own most of them have features youll never use which makes it over complicated
Otherwise acf is finee
one thing that'd be good to learn is creating commands without having to register them in the plugin.yml which is powerful because you can commission/decommission/change commands at any time
yes i know ๐ that is why i search an command framework
i think i go use ACF because i use Paper so that sound good ^^
I think it exist a entity kill thing
Like entity.kill I will look at that later
no
public void loadSchematic(Player player, String name) {
Location location = player.getLocation();
WorldEditPlugin worldEditPlugin = (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit");
File schematic = new File(worldEditPlugin.getDataFolder()+ File.separator + "/schematics/" + name + ".schematic");
EditSession session = worldEditPlugin.getWorldEdit().getEditSessionFactory().getEditSession(new BukkitWorld(location.getWorld()), 10000);
{
CuboidClipboard clipboard = null;
try {
clipboard = MCEditSchematicFormat.getFormat(schematic).load(schematic);
} catch (IOException e) {
e.printStackTrace();
printConsole(CC.RED + "An error occurred whilst loading this schematic!");
} catch (com.sk89q.worldedit.data.DataException e) {
printConsole(CC.RED + "An error occurred whilst loading this schematic!");
e.printStackTrace();
}
clipboard.rotate2D(90);
try {
clipboard.paste(session, new Vector(location.getX(), location.getY(), location.getZ()), false);
} catch (MaxChangedBlocksException e) {
e.printStackTrace();
player.sendMessage(CC.GREEN + "You tried to paste too many blocks!");
}
}
error:
ill copy and paste the answer you got in the other discord you just posted this in
File schematic = new File(worldEditPlugin.getDataFolder()+ File.separator + "/schematics/" + name + ".schematic"); most likely
Hello i have a problem with spigotmc for gradle
i want this import: import org.bukkit.craftbukkit.v1_16_R3.entity.CraftFallingBlock;
build.gradle https://code.alwyn974.re/igipinatus.coffeescript
Did you run BuildTools?
guys?
yep
hello guys, i have problem.. today i get this error 5x and the player get kicked.. any solutions?
https://pastebin.com/dRy0wfti
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.
players have big ping, and they got disconnected
tps was 20
What is SpigotPackDecoder
idk
no i installed the buildtools
yes but did you run it
you're also missing mavenLocal(), which is needed as buildtools automatically installs it to your local repo
does anyone know how luckperms does the luckperms.autoop permission?
it automatically gives a player with that permission all permissions
no
that is only used when the vanilla OP system is disabled via luckperms and the only way to have OP is to have that permission
it automatically OPs you on join and iirc deops you on leave
so it's only /op?
yes but /op would be disabled if you enabled the usage of this perm
yeah i know
C L O U D
Is there something like the Vault API for a BungeeCord plugin? e.g. if I want to get player groups via BungeeCord (assuming there is a Bungee compatible perms plugin installed)?
if (player.getLocation().getYaw() > 90 && player.getLocation().getYaw() < -90) clipboard.rotate2D(90);
if (player.getLocation().getYaw() > 180 && player.getLocation().getYaw() < -180) clipboard.rotate2D(180);
clipboard.paste(session, new Vector(loc.getBlockX(),loc.getBlockY(),loc.getBlockZ()), false);
how do I change
where it spawns
I wanna paste it where the player is looking
Ray trace the block the player is looking at. You can use Player#getTargetBlockExact(int range) for that.
Then you need to find out the offset of the clipboard
private Location getTarget(Player player) {
RayTraceResult target = player.rayTraceBlocks(200);
if (target == null) return null; // no hit
return target.getHitBlock().getLocation().add(target.getHitBlockFace().getDirection());
}```
ty for compensating for my needs
He is from the future...
Are you on 1.8?
maybe...
Then good luck ^^
oh no ๐ฆ
ok I take back everything about 1.8 being easier for development
because worldeditapi just kicked my ass
now this
bruh
there is a discord for people who develop for 1.8 maybe you can find it
Isn't it a joke discord?
Yea
How do i get the name of an inventory
Via its view
wdym
Get the view of the Inventory and get the title from there.
Does anyone have an idea why this is happening: ```entityPlayer.getName() returns new name set in GameProfile
Bukkit.getPlayerExact(name) returns null```
When I decompiled it I saw getPlayerExact uses the method entityPlayer.getName so I really don't understand
Bukkit internally keeps a Map<String, Player> and doesnt iterate over each player when the method is called.
And this map doesnt magically update just because you set a field in the players profile.
and where exactly is this map, that's what I've been searching for
net.minecraft.server.<v1_16_R3>.DedicatedPlayerList
can I send pictures here somehow
If you link your discord with your Spigot account then yes
okay well I'll try to explain then
I went into DedicatedPlayerList and looked at the object that was stored
and the game profile was indeed updated
wait hold on
no it still doesnt make sense
yes sorry the dedicated extends
And this map gets accessed by CraftServer#getPlayerExact(String) method
indirectly
yes
How do i change where my jar goes when I build with maven?
so why does it return null
Because the given String is not present in the Map unless you put it in there.
But suppose I have a list of EntityPlayers
and iterate over that
then it wouldn't work
Iterator iterator = this.players.iterator();
while(iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer)iterator.next();
if (entityplayer.getName().equalsIgnoreCase(s)) {
return entityplayer;
}
}
return null;
}````This would return null for some reason
even though entityPlayer has the updated gameprofile
If you would iterate over a list and check each name then it would work. But it would also decrease the complexity to O(n)
I wasn't gonna mention this but tell it to the guy who made the 1.8 source code
I guess I won't get any more support now lol
Yeah... 1.8 is half a decade old and support was dropped several years ago for good reasons.
but this is kind of not 1.8 related though, more related to java in general
because the object in the list is updated
use attributes
There is a lot you can try. Take a look at this post:
https://stackoverflow.com/questions/6689511/how-to-place-the-output-jar-into-another-folder-with-maven
Thanks
does anyone know what Packet20NamedEntitySpawn (from mc 1.5) is in 1.8.8 lol?
You speaking french idk "we"
so funny omg
PacketPlayOutNamedEntitySpawn
seems pretty straight forward
Anyone know how to use protocolib to make a player not see the other?
Or give fake armour stand
Probably, what exactly do you want to achieve?
That can be achieved using the API.
For a client side armorstand using protocol lib, spawn it using PacketType.Play.Server.SPAWN_ENTITY
Hello, i re ask my question because i have look on hch and DazzleConfig but im not fan, i din't found how i can save the config at the demand and i search something more like Yamler.
My question : somebody know an good API for easier make configuration (like annotation or something else) ?
Ye how to use its api
declaration: package: org.bukkit.entity, interface: Player
make your own
Wtf u giving player interface?
U use DazzleConf?
it's already very easy
Thats not api of protocolib
Protocolib api not bukkit api
You do not need protocollib to hide players from one another.
I want no packet about the player, i want the game to not know that player is even near
Does you know why I get this error while trying to de-serialize a class?
https://mystb.in/AcousticJohnAngeles.properties
Class:
https://mystb.in/NotifyHackerEntertainment.kotlin (MongoJack)
that is exactly what that method does
you do it for each player
You'd be doing the same thing sending raw packets yourself.
If i hide player he will not be seen by anyone
!jd
why can't blocks be placed if the players are hidden?
Its relative. You hide one player from another.
Does anyone know which event is fired when you tab after /
there isn;t an event fired. when you press a key tabcomplete is triggered
the tab is client side
Nothing is sent on pressing tab
you just offer the client suggestions
tabing means you use one of the suggestions to fill it
implement Tabcompleter
I'm trying to remove some commands they don't have permission to but the implemented tabcompleter method doesnt get fired for some reason
if a player doesn;t have permission for a command it won;t show up in teh tab offering...
I have a custom command class
IF that command is correctly registered with that permission
custom command system
then properly register yoru commands and permissions
the command is registered
thats half of it
well permission management is also working but that shouldnt do anything to the tab completion rn
yes it shoudl, as I just said
you can still prevent sending suggestions
commands are only visible on the client if that commands permission is given to the player
yes
and I am trying to remove those commands that they don't have access to through the tab completion method
but it's not fired
YOU don't remove them. the permissions do
i must remind you this is a completely custom command manager
Yes, you have a broken design and refuse to implement it properly
how is it broken
The command map is sent to teh player upon login and when player.updateCommands() is called
it ONLY sends those commands the player has permissions for
but how would it know what the player has permission for if it's a custom command manager
If your "custom" command system is not assigning permissions to the commands then everyone has them in the command map
Exactly, you registered the commands but did not add permissions to them
so everyone should show up in tab complete, right?
as you have not assigned permissions to your commands every command will show up in tab complete
okay but tell me then why tab complete method isnt fired then
what?
`This method is not ran when I try to tab after /@Override public List<String> tabComplete(CommandSender sender, String alias, String[] args)
it does not run on the root commands, those are in teh command map
tabCompleter triggers on args
So I would check for PlayerChatTabCompleteEvent?
PlayerCommandPreprocessEvent?
Just do it proerly and assign permissions
If you are not doing it via plugin.yml https://hub.spigotmc.org/javadocs/spigot/org/bukkit/command/Command.html#setPermission(java.lang.String)
was about to ask if that was the method I would use
when do I add the permission to the player? @eternal oxide
Depends
The PLayer object is available in PlayerLoginEvent but their current world will not be, so if you have world specific permissions you can;t assign them there. However, some plugins like WorldEdit expect permissions to be assigned at that point so you really need to add their permissions at PlayerLogin and PlayerJoin (as you have a correct world then).
If you change the players permissions you have to call player.updateCommands(). Good luck if you are on a old API as that method will not exist
Doing it on join would work, ty
You generally don;t assign permissions yoruself. You leave that upto a permission plugin and the server owner to decide
This is not for public use in any way so I don't think that would become a problem in the near future
player Join will be too late for the command map. Thats sent after player login. You would have to call updateCommands() if you assign them in player join
no, There is no player available in that event
there are two PlayerLoginEvent and PlayerJoinEvent
the command map is pushed to the client after the first event but before the second.
there's always a catch
I think updateCommands() was added around 1.14
mhm :I do you know if there's any packets that fixes this for other versions
Not that I know of. You just have to ensure your command permissions are assigned in the Login event
the problem is I don't have that event unfortunately
You don't think something like Player#recalculatePermissions would update it?
wait how do you even add permissions to players
PermissionAttachment attachment = player.addAttachment(plugin)
adding a permission to the command itself doesnt stop it from being sent to the player ๐ starting to really hate this now
the command permission has to be on teh command before teh player joins
could me being op have any effect on this?
yes
well there we have it
now it's sort of working
this is really interesting
either it updated the commands after PlayerJoinEvent or it sends packets when you add attachments to the player
because I was able to add the permission on join
lucky
why does this happen?
the logs are florests (supposedly) the grass is plains and sand(which does not exist on the pic) are deserts.
?paste
You are returning a new random every time you call seedRandom(). That won;t be very random.
you create the random once then get the next random from it.
Are you from some strange place where _ is accepted in a number? return new Random(10_1_4_23_15_14+12_4_19)
You shoudl be passing in a Long value
basically generate a Hash from whatever seed you want to start with
that's so it resets every single time
so if I try to get the value of 3 in the random and for example I get 1
and I will get 1 the next one...
tho I'm probably wrong on that one
thats not how Random works
it still doesn't really matter that much
the seed random is only used twice..
so it really shouldn't matter at all
You need a Random for each of yoru seeds, then get next to fetch teh next random number
wdym?
I'm using PerlinNoiseGenerators.
The error is that the biome generation is stupid
well
teh generation is tupid because you are not using Random correctly
stupid in the way that it is not like, a biome and then it switches....
don't know how to explain
wrong
that might even aswell be like this:
seed+1
because it will be like that all the time
and using the same seed on a perlin noise generator, will just give the same NOISE
so it doesn't matter.
BlockPlaceEvent ๐คฆโโ๏ธ
BlockPlaceEvent
prob beginner
i was about to make a joke and say BlockBreakEvent
breh moment
what ide is it even
never used.
reasons to use Intellij (probably none)
Looking for help, if someone wants to help. #help-development message <-
Probably something went wrong with my ide, no suggestions appear anymore
Probably, should move to IntelliJ. It is personal preference tho
Ok
I'll take a look
Thanks for suggestion
What jre do most of you all use
OpenJDK 11 and build for JRE 8
Whats the packet for client data on logging in?
I have some weird bugs, when I click sometime I can deposit an item where I shouldn't be able to while cancelling the inventory click event