#help-archived
1 messages · Page 88 of 1
Anyone willing to make nms npcs with pathfinding, they would target a certain player if they are a "Villain". They need to have armor and should have the ability to follow a player when I want it to. I have a system for the villain/neutral thing already set up, I would just need the nms because I don
don't have much experience with it
I also develop so it wouldnt just be you in the dark
You might have more luck asking on the forums for someone to actually help you code something.
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
using VaultAPI how would i get the name of the rank? with color?
Does anyone know what the best way to create an expandable inventory would be? As in multiple pages, and when 1 page is filled up, a new one is automatically created
I could make a new inventory every time the previous one gets filled up, that's not too difficult, the problem is how do I reference that inventory?
Someone help me 😦 I placed my resource pack in the minecraft folder but it's not working :(
ping me if you know what the problem is
That is really really vague
Jet
You should probably use a map or something for that
And then a method to check if filled and yeah create a new one in the right order then
@naive goblet how would I use a map?
When i want to include data/datapacks to my plugin, where do i put them?
why would you need to include a datapack with a plugin?
I don't think u can include a datapack with a plugin
I have vanilla loottables i want to use
Theres a “Bukkit” datapack, which says: for data provided by plugins or stn like that, so somehow it must be possible
why wont Bukkit.getServer().getOnlinePlayers().size(); erroring Error:(12, 58) java: cannot find symbol
symbol: method size()
location: class org.bukkit.entity.Player[]
thats really a dummy thing; datapacks are independent from plugins
@frigid ember you're trying to compile against a REALLY old version
like > 5 years old
thats big oof isnt it
if i do 1.5.12 it works on all version still right?
1.15.2
depends; but usually on later versions are supported not older versions
I think its not dumb, using minecraft external files for plugins, i mean it saves you much time instead of codeing Recipes etc
yea no it still does it on 1.15.2
you might be getting an old version from another depend
make sure spigot is at the top of your depend list
first
where?
above any depends you may have on other plugins
idk, depends on your IDE/build system
Intellji Maven
so at the top of your <dependencies> section in pom.xml
it is.
well bukkit is? is that fine?
nvm ill just add spigot
Nah still does it.
is there any way to use more than one cores for spigot servers?
for (String s : HubCore.getInstance.getConfig().getConfigurationSection("queues").getKeys(false)) {``` any reason for this to be null?
@velvet halo there is plenty tutorials on the internet how to use ScheduledExecutorService
keep in mind that its an Async executor though so you cant kick players, change blocks, spawn mobs and things that need to be on the main thread
and a really good advantage of that is it uses TimeUnit so its better than the bukkit's scheduling crap
getInstance returns null perhaps?
or the section, anyway use dependency injection instead of singleton pattern
ive already explained why its better in the case of bukkit plugins/overall
@frigid ember
also, getInstance should be a method, thats how you name methods not fields.
huh
I mean that you probably have
public static HubCore getInstance;
in your main class, thats not a name of method
its a field
should be instance and then make a method that returns that if youre gonna go ahead and use singleton pattern
i got lazy
HuBcore.getInstance is ()
its a method holy fuck i cant speak at 5 in the morning
Also yes i did set instance to this
fine, could you just use a dependency injection
how so?
Passing objects through the class constructor
private final HubCore instance;
public ClassName(HubCore instance) { this.instance = instance; }
Wdym this is in the class
the class where for (String s : HubCore.getInstance.getConfig().getConfigurationSection("queues").getKeys(false)) { is.
bruh you cant use both either use SP or DI
i already said what could be null. Either the section or getInstance() but u said u set it to this onEnable()
so the section is null perhaps.
how would the section be null tf
the section is in the config file 😄
maybe it has no keys then
um
i am losing my mind at 6 in the morning
section has keys
``
section1:
section2: <- key
value1: 2381723
value2: 2318721
``
getKeys(false) would return section2
queues: YourServer: name: "HCF" maxplayers: 120 paused: true YourServer2: name: "Kitmap" maxplayers: 120 paused: true
is what i have.
im not sure but i think you need to follow the YAML format
which is you should have 2 spaces
in queues: YourServer:
ok.
ok fixed it but i still need help with the null
i mean that should fix it
bruh no idea
if getInstance() is not null and section is not null too
and it have keys then i have no idea why it returns null
make sure u compile it and reload the server
i restart the server everytime and compile it.
no idea
the thing is it works fine in a different class
what possible could be null...
@brisk mango just checked this is returning null HubCore.getInstance().getConfig().getConfigurationSection("queues")
is there any way to use more than one cores for spigot servers? pls help
ye
its after my knowledge a default feature in paperspigot, @hoary parcel correct me if I'm wrong
It's not called paper spigot, just paper
And yes, paper uses multiple cores for all kind of stuff
This isn't the place to discuss this tho, discussion about paper should be on papers discord
True
wtf has happened here, i am creating a command to add lore to an item and it keeps having a flipping internal error!!!
error: https://hastebin.com/wuyohijocu.bash
code: https://hastebin.com/isefaducuj.java
main: https://hastebin.com/yosafegiji.java
Arrays start to count at 0
seems like your array is out of bound
you also never checked args length
oh ye
means you are trying to access a index which is not given
lulz
lol wish i wuz then i wouldnt look so dumb xD
u fully know java yet u use == for comparing strings and method calls from a constructor
first of all
?paste
That is exactly how you compare strings, you use an == operator 👍
learn how return/return true/false works , and learn when to use non-primitive types and primitives
@velvet halo
👌
nope u use equals methode to compare strings lol
hes joking obviously
:3
because this dude said he is 12
Wasn't sure about that one yikes
and he is fully able to develop java
yet he is worse than most the noob plugin developers
" To develop java " working on a own jvm then, huh?
xd
CJ# then?
and 1 more thing, ItemMeta and lore can be null @oak stump
No C++CJS#
OOooii @velvet halo bro I'm in
F#
symb0lizm do whatever you want
Does anyone know how to stop an ender crystal to destroy other crystals in range (i allready canceled the EntityExplodeEvent)
ye
make it an own entity which can't explode
or just disable explosions in the area
make it an own entity which can't explode
@frigid ember how do you mean this?
quality English entered the chat
Endercrystal c = new Endercrystal {}; and just make it non-exüöpsove
quality English entered the chat
@oak stump Sorry im from germany and i know my english isnt the best but i try it at least instead of using only google translator
no worries lol
Bin auch deutsch @lofty mica dm einfach wenn du labern magst
@lofty mica listen for EntityDamageByEntityEvent and check if the victim and damager are both ender crystals then cancel it
@lofty mica listen for EntityDamageByEntityEvent and check if the victim and damager are both ender crystals then cancel it
@pastel basin is also already canceld. no entitys get damage no blocks get destroyd only nearby crystals disapear
if i hit the left then nothing will be destroyd and nobody gets damage only the right crystal also disapears
then disable the trigger event
like just check which causes the second one to vanish and cancel that one
@proud furnace ja und du must ihn sichtbar machen
Entity entity = world.spawnEntity(location, EntityType.ENDER_CRYSTAL);
entity.setCustomNameVisible(true);
entity.setCustomName("name");
then disable the trigger event
@frigid ember Wich event do you mean exactly i cant find a "TriggerEvent" in the spigot doc's
lol
Anyone here got any experience with forge servers? Currently trying to set one up but receiving an error upon startup, never had this before.
You are asking a question in the wrong community @forest sigil
Anyone here got any experience with forge servers? Currently trying to set one up but receiving an error upon startup, never had this before.
@forest sigil You need to install the vanilla minecraft server in the same folder
I'm asking a question in a community full of minecraft players, surely someone will know.
Hast du schon das ExplosionPrimeEvent probiert?
Nein probiere ich jetzt aber mal
@proud furnace and @lofty mica if you are just going to talk german between urselfs may as well do it in private PMS
Oh ok sorry i will talk english
Speak whatever language you want lol, isn't any rules.
ExtraLimo did you also got warned for marking peoples xD
I never said it was against the rules
Just said if they are having a conversation in german just between the two of them then they can just talk privately 🤷♀️
yeah is at me the same
Vanilla items have no ItemMeta @sturdy oar
like found items.
and AIR also has no ItemMeta
Well in that case I think I might have to ignore Intelli's warning
Doesn't get item Meta create one if needed?
I'm 100% sure this will not be null
i can't think of any case where it could be null
Hey! I have problem with https://www.spigotmc.org/resources/broadcast-1-7-10-1-14.27127/ . Plugin is overwriting by Essentials. Is option to disable Essentials /bc command?
SkullMeta can be null...
Not all itemstacks are going to have a player head material...
if anyone want to know the solution for my problem: ```java
@EventHandler
public void onExplosionPrimeEvent(ExplosionPrimeEvent event) {
if (event.getEntity().getType() == EntityType.ENDER_CRYSTAL) event.setRadius(0);
}
I'll just add this, @SuppressWarnings("ConstantConditions")
Objects.requireNonNull works too
well that adds an extra check tho
Hey! I have problem with https://www.spigotmc.org/resources/broadcast-1-7-10-1-14.27127/ . Plugin is overwriting by Essentials. Is option to disable Essentials /bc command?
@brave tapir Any idea? :/
Jvm will optimize it away
Can also add an assert, thats not present in runtime at all
Is any option to set plugins "weight"?
just use plugin:command
Yes. I know that :// hmm.. ok, so i will be using that
casting itemMeta to being a skull meta is gonna return null because how is an itemMeta going to know the an itemstacks material is a player head.
what are you on about
I know it does
it's 100% safe, since I'm creating myself an ItemStack which will ONLY be a playerhead, a skullMeta can always be created
that's why I'm silencing it
Why it still thinks it is null
@hoary parcel do you have any ideas for when getItemMeta could ever be null?
When casting it to SkullMeta...
just so you know, the jvm throws a classcastexception when the object is of the wrong type
it doesn't magically make it null
I know
clearly not
You are not getting my point obviously
I'm getting basically every method highlighted from ItemMeta
even setDisplayName
it's kinda annoying
I'll have to suppress the whole class
Since ItemMeta has many inherited classes when casting it to a derived class the IDE wants todo a null check to make sure if itemMeta currently holds that derived class.
no.
Then why does the IDE still think skullMeta is null?
because the spigot API annotates getItemMeta as nullable
Its just there to inform you it might be null @sturdy oar
and now i see why - itemmeta is null for AIR
Not only for air @silk bane
there is no other case where itemmeta is null
i have the source in front of me @brisk mango
have no ItemMeta
no, they generate itemmeta when the method is called
bruh, vanilla found items dont have an ItemMeta
the hell are vanilla items
found items
getItemMeta returns a value for them
No they dont, I disscused w choco about this @silk bane
@subtle blade
it returns null for vanilla found items
could you give me some examples of 'vanilla found items'
Found items in mineshaft minecart for example
oh those
return CraftItemFactory.instance().getItemMeta(getType(item));
}```
literally creates itemmeta if it doesn't have any
Items in treasure chests
Why the hell wouldn't they come with a meta
CraftItemStack
@subtle blade explain yourself
just answer a question
lol
anyway, it won't return null for those
we've discussed about this
you can check the source to verify
It might not return null but it doesnt have an ItemMeta if its found @silk bane
Iirc the only case it can return null is AIR
that's literally what i just said but ok
no
I didnt mean thats its null
I meant that it doesnt have an ItemMeta
for vanilla items
whatever bruh
ItemMeta can be null?
yeah
AIR
Just look at the code
bruh we we just said it
Bukkit api Design 101
thats why its annotated as @Nullable
all those ide warnings every time you use itemmeta
Make Sure to never be consistent
Explain how this creates new item meta? (This isn't to argue or prove you wrong just a general question)
just on the off chance that someone creates an itemstack of air
CraftItemFactory#getItemMeta creates a new itemmeta
it doesnt create a new ItemMeta
And craftmetaitem is the worst class in bukkit anyways
return new CraftItemMeta(...
this shit is weird as fuck
It's bukkit
the file is in the package org.bukkit.craftbukkit.inventory
the name is CraftItemStack
ah yes youre right
When I say bukkit I often refer to the whole shit stack
Confusion why you would do getType(item) again in the getItemMeta function when it is done again in the switch statement o.O
we should all move to glowstone
no, we should move to canary
It still inherts the bad API 🤷
i meant bedrock
i agree
hell yeah
Or to copy of bad API?
Well, I take an alternative approach, trying to make the stack better
I mean, the whole code of minecraft is shit, both spigot and minecraft client lol
No it isn't, vanilla has gotten really clean
and he does it by using mojang's mappings in a somewhat questionable way
It was atleast
Look at how vanilla handles blocks via the material enum in bukkit ^^
i've went through it a couple times
its really poorly designed
overriden method calls from constructors etc
I was taking about my contributions to paper there konsolas
How long ago was this beta 1.2?
No it isn't, vanilla has gotten really clean
You mean less worse
The shit I do with mojang mappings for dyescape isn't clean in any way 😂
ah
I mean, it's better than protocollib and stuff
when is that coming out?
how much work on dyescape has to be redone every major minecraft update?
Will dyescape ever release lol
The last updates were really easy
We don't do much stuff that uses code that changes
And most stuff is abstracted anyways
cool
in 6 days it has been 3 years since dyescape became a thing
I only been with them for half of that time so don't blame me 😂
In the time I was with dyescape we went from 1.12 to 1.15
So you made it go 2x faster 😛
And I replaced all public plugins
maybe it would have been 6 years if you didn't show up xD
It was playable before too?
Now it's only about fixing bugs, helping content team code the content in (it's a giant json file hell) and implementing small new features
Do you guys have a quality assurance team?>
Well, we test internally and plan on to recruit active community members
It's something we talked about but haven't done yet because there wasn't really anything that could be tested easily
But yes, we want to avoid the hegemondastrophe at all cost obviously
What is that? My dutch background doesn't understand what hegemondastrophe is xD
The hegdemony catastrophe 😂
It's the server city works for
Big hype, 2k ccu at launch, everything went up in flames, shit was buggy, now they happy if they have 5 players
We are more about moving slow and save and natural growth and stuff
I remember that harry potter server had 2000 people come online for launch
one week later it was dead
To be honest Rolings Realm wasn't that awesome, played with my lil sis a bit on it recently and it was trash
do you guys know why newtshop-gui-shop dont exist any more ?
Hey I bought a plugin but I didn't receive it it's been 2 weeks now, and the developper don't answere to me ^^ can you help me please ? (i'm french sry if my english is bad)
sounds like a scam. Contact the staffs
Hi everyone,
Since days, I tried to reproduce the behavior of a jukebox with a custom song of my resource pack.
The song is located to: minecraft:custom.<song_name>
I just want than my players ears a song in an area just like the jukebox do with CD.
With command bloc, I can't reproduce the same behavior.
So, here is a list of the features I'm looking for:
Play a song from a resource pack, in a coordinate thanks to a command or a bloc as a target. Set a radius to define at which distance the song will be heard. Loop the song. The song will be heard by everyone walking by. Compatible with 1.15.2
Thanks a lot for your help.
I didn't find any existing plugin.
Have a good day!
-LArchitect
Im having a problem with my Plugin "GriefPrevention". So If someone has 3 accounts and if logon with more than 3 accounts the 4th+ account gets instantly banned.
disable that in config
So MaxAccountPerIpAddress = false
Either that or change the number of accounts/ip
and then you do /gpreload
ig
maybe reload
or restart server
and be sure you have the appropriate config for your version of gp
yeah reboot is even better
the config works because i disabled claiming in certain worlds and it worked
ok a restart makes it work
it works now
do you guys know why newtshop-gui-shop dont exist any more ?
@whole sigil any idea ? ? ?
"Connection Refused" this error when my friend tries to enter the sv and sv is hosted on my hoteador what should I do?
sorry I'm a Brazilian router and I remembered how I spoke in English
sv = server
yes i open my server via my router's ip
yes
alright, is your friend able to join other servers?
possibly yes, when he tries to enter my server this error "Connection Refused"
I found a typo in the documentation for bukkit
kind of a typo
it's actually incorrect information that seems to be copied from somewhere else
@tawny gale @naive goblet normally premium resources are reviewed by staff before release
may just try to message the author using another medium
e.g. twitter or discord
Whats the perm of /ptime command?
essentials.ptime
Anyone free to have a quick chat in pm about some code ive written that isnt working correctly?
sure
yo whats the issue here, i know it says plugin already initialized but whats that mean???
error: https://paste.md-5.net/xeyogafeyo.css
command: https://paste.md-5.net/egosozulen.java
main: https://paste.md-5.net/izibalanug.java
Seems like you initzialized it twice
use JavaPlugin.getPlugin(Main.class) to access methods of your plugins main
i cant find where tho
Kiddin me? Line 27 lol
its not tho
it is, in your error message it states to look at line 10 in your main class which is on enable
passing a main class causes the error
The Problem is you double init stuff, gosh, get your stuff right and focus on learning how to write stuff
for example get some extra help command class
also you dont need to translate color codes manually
Pls learn how to work organized first if thats your work
its not for once
Pls tell the author then to organize stuff according to the java naming conventions, coding guidelines and to use the spigot api correctly.
I don't know and I won't find out since I don't want to hurt my eyes and torture myself lol
lol
pls help
smeltery is not working in my server
logs?
sec
Btw don't mind censoring the IP's of your users, I am sure they like having there IP's exposed in public @frigid ember lol
@frigid ember pls help me fixing it
plsss
the plugin isn't even loaded at startup lol
what plugin
smeltery
i dont have plugin named like that
and how is it named then?
i have an issue that all smeltery is not working
so furnaces not working at all?
yes
pls help
@frigid ember is worldguard or griefprotection may blockign it?
maybe
how can i fix that ?
command ?
Idk, may by combat with the plugins?
Just figure it out by debugging your stuff manually
i use worldgurd
Yeah just mess arround till it works lol
temporarily remove plugins till it works
then figure out what in that addons i messing with it
normally premium resources are reviewed by staff before release
@frigid ember indeed and always. But if I understood the case right then he was the buyer which has nothing involved in what you're talking about.
why does 1.8.9 not exist?
ok what
so 1.8.8 is the same thing as 1.8.9
yes
ok
server sided yes
the recipe iterator doesn't seem to get any MerchantRecipe
how would I get all the Merchant Recipes?
How to make ranks and permission stuff on bungeecord?
looking for a plugin?
Yes
Yes but luckperms don’t wrk by MySQL
why would you want a mysql system for bungee?
And I tried to put the luckperms plugin in the bungee plugin folder but it doesn’t work
ok!
Is it normal, that things like give @p itemXY{Enchantments:[{}]} dont work on Spigot Servers?
When i modify using /data merge, as long as it lays on the ground, its fine, but when i pick it up again the NBT Data is gone
Why is bungee cord so expensive :/
Huh
I made a simple list in my config how do I get it to go to the next line after each message here is my code
String hlpmsg = plugin.loadString("HelpMessage");
if(hlpmsg != null) {
p.sendMessage(hlpmsg);
}```
I do hlpmsg.split("\n")
i tried that it didnt work probably something i did wrong while doing the list
public String loadString(String config_value) {
getConfig().getStringList("HelpMessage");
return ChatColor.translateAlternateColorCodes('&', getConfig().getString(config_value));
}```
is "HelpMessage" a string or a string list?
Well y2k u can load a stringlist from strings
not sure about the other way. However change return type to List<String>
okay
you cant return just List<String>
String getStringList() {
return getConfig()
.getStringList("some.list.path")
.stream()
.map(Utils::color)
.collect(Collectors.toList());
}```
It requires you to have a color method that only takes a single String param
return an ArrayList<>
ChatColor.translateAlternateColorCodes('&', getConfig().getString(config_value));
this would return a single string
you'd need to loop the color method on all list elements
then return that list
List<String> getStringList() {
List<String> loredList = new ArrayList<>();
for (String line : getConfig().getStringList("HelpMessage")) {
loredList.add(ChatColor.translateAlternateColorCodes('&', line));
}
return loredList;
}```
make a new list
and loop throug the original list but everytime you translate color
return the new list
I see some resources claiming that PlayerInteractEvent is the event I should listen for to cancel trampling of crops.
However; all the resources I have found are outdated by a few years each.
I'm wondering if PlayerInteractEvent is still the event I should be subscribing to
I am quite surprised honestly that this wouldn't fall under BlockBreakEvent
PlayerInteractEvent should be the event. The movement event only determines when player moves and afaik there is no "PlayerCropDestroy" event.
Conclure I get an error onGetStringList()
Syntax error on token "getStringList", AnnotationName expected after this token
Yeah that's true
Yea, Interact event sounds fine, given that that trampling is an interaction
So farmland is a partial block; will PlayerInteractEvent#getBlock or whatever return the farmland, or the crop
Hwiggy it's probably to seperate when a player breaks a crop by left clicking from when a player is actually jumping on a crop to destroy it.
Y2K send ur method
I also suggest to get some more general experience about java List<E> and arrays in general.
I love the javadoc comments on Action.PHYSICAL
fixed
/**
* Stepping onto or into a block (Ass-pressure)
i accidently put it in another method
lol
shhh
Hwiggy fr yeah it's really questionable
I mean perhaps it is BlockBreakEvent now? Then I'm outdated.
other events are often also fired from PIE
yeah
PIE is just super early, so makes stuff like that ideal
thats true
what shold i put in place of loadString?
if(hlpmsg != null) {
p.sendMessage(hlpmsg);
}``` if i change it too getStringList i get errors
im aware xD
thats why the errors exist
but i get errors on p.sendMessage
if i change it to a list
You make String = List<String>
well
make a method to send an array of messages to a cmd sender?
you can use varargs for that :]
Thats the problem. Im not coding. Thats why I asked in general for some premade solution
That complicates stuff though.
Havent found any specific rules, so I thought, this channel is for spigot/bc help only 😄
This problem is spigot related?
Does anyone know how to add permissions I'm using Luck Perms and it also has a web editor please if anyone is good at permissions or generally is a good dev please contact me in rlly in need of a dev
Well, kinda. So... :D
Is there some way to make Sharpness work like Power? So instead of flat DMG, its actually x% + lvl?
Thank you!
SaltyDaddy I don't think there exist something like that
DogLover /lp user/group <name> perm set <perm.node>
In my listener for InventoryClickEvent, the code runs fine if a player clicks on the given ItemStack, but if the item is damaged, it doesn't work even if its the same item type.
Hey, I'm having a hard time downloading Spigot and setting it up with Visual Studio Code would appreciate any tip:)
Why do you want to use it with VSC tho? @obsidian pulsar
Its just the ide that i already have downloaded
Hi
How to get a first key and value from hashmap ?
HashMap<String,ArrayList<String>> playerInfo = new HashMap<>();
playerInfo.put(getPlayerGroup(playerName), (ArrayList<String>) getPlayerPermission(playerName));
return playerInfo;
there is no first key
you can get a key if you get the entry set and use an iterator to get an entry
Tadzio you may use a MultiMap when storing a Collections iirc -> (manages it better)
How it use ?
But as Banana said
((Damageable)currentItem.getItemMeta()).setDamage(0);
if(currentItem.equals(new ItemStack(Material.ELYTRA))) {
((Damageable)currentItem.getItemMeta()).setDamage(damage);
Player p = (Player) playerInv.getHolder();
p.sendMessage(ChatColor.DARK_RED + "You can't use that in spawn!");
for(int i = 0;i<enchantments.size();i++) {
currentItem.addEnchantment(enchantments.get(i),enchLevel.get(i));
}
event.setCancelled(true);
}```
int damage = ((Damageable)currentItem.getItemMeta()).getDamage(); returns a NPE if its an elytra with damage clicked. Not sure why
any help?
ItemStacks, ItemMetas isn't Damagable
If you're holding a Chest ItemStack in your hand or if it's in your inventory, it's not considered to be a TileEntity, right?
I was under the impression that when a chest has been placed somewhere that it becomes a TileEntity?
ive tried using the itemstack but then it returns with a casting error
what are you casting?
an itemstack to damageable
im just trying to check if an elytra has durability damage, its giving me a lot of trouble
just a note, damageable is for entities
Don't use that interface
i think damageable is used for that
it's the new durability
yup
for meta
probabily there is an entity damageable too
oh yeah
not sure
He doesn't need to use it for casting though?
is discord dying for you too guys?
where item is your item stack
I
I've tried that but it returns with an NPE
Idk Damagable should be useful
but it doesn't have any classes extending or implementing it
Is there any plugin request section on spigot forum?
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
people post stuff there
"at least 20 posts" well damn
I have acc with 20 premium plugins, but now I need to spam the forum? 😄
That was meant to be ironical
@pastel condor if(currentItem.getItemMeta() instanceof Damageable) { Player p = (Player) playerInv.getHolder(); p.sendMessage(ChatColor.DARK_RED + "test"); Damageable itemDamage = (Damageable) currentItem.getItemMeta(); int damage = itemDamage.getDamage(); itemDamage.setDamage(0); if(currentItem.equals(new ItemStack(Material.ELYTRA))) { //((Damageable)currentItem.getItemMeta()).setDamage(damage); p = (Player) playerInv.getHolder(); p.sendMessage(ChatColor.DARK_RED + "You can't use that in spawn!"); for(int i = 0;i<enchantments.size();i++) { currentItem.addEnchantment(enchantments.get(i),enchLevel.get(i)); } itemDamage.setDamage(damage); event.setCancelled(true); return; } }
the message is sent to the player at the top, but nothing else runs
no errors in console
can you show me the higher up code?
how is that being called?
a listener?
command?
@cerulean snow
a listener, InventoryClickEvent
The if statement won't match since the object reference for the players current item is different to a new object reference
Compare the material of the itemstack instead
I would assume current item is event.getClickeItem()?
nice that worked. changed the if statement to if(currentItem.getType().equals(Material.ELYTRA))
thanks for help @pastel condor @scenic ocean
oh yes you would want to do that 🙂
Anyone here can help me with setting up Spigot?
hello
I have a location, and I try to modify the block at this location :
Material sign_material = Material.OAK_SIGN;
Block block = this.location.getBlock();
block.setType(sign_material);
block.setBlockData(sign_material.createBlockData());
Sign sign = (Sign) block.getState();
I modified the sign variable with sign.setLine(index, line), but this don't modify anything, my sign is empty
I read after that with getState(), I have an immutable view of the block, so how can I modify it really ?
There should be a sign.update() method.. or something like that
Yeah, a BlockState represents a block state, not a current block
If you make changes to it, you have to call update()
oh yes, I see
does it works too if I modify sign_material.createBlockData() as a sign, and use setBlockData of this block_data ?
Hey all, a question, what would be a good approach of have an player like object. Perhaps passing the player instance in the constructor?
Well I have a player that will have some specific additional properties on top of the existing spigot Player
So I try to have a class that contains the additional properties
So passing it through the constructor isn't much of an option here. Player instances are thrown out after they log out. A new instance is created every join.
I applications you would extend the class, but I don't think I can extend Player myself or if that would be a good idea is it?
in*
No. CraftBukkit implements Player, plugins cannot. It won't work
Your best bet is to have a Map<UUID, ClassRepresentingAdditionalProperties>
UUID being the player's UUID, obviously, and the value being whatever class you're going to use to hold said properties
hmm
If at any point in the properties you need a Player, pass it to the method as an argument. You should be able to supply a player whenever you need to call it
But what if I use the constructor, and use events Join and leave event to remove the class?
Sure though you're also going through a lot of hassle for no reason
It's an option, and a viable one at that. I just don't think it's really necessary in this case when you can just pass players as method arguments when necessary
If you're holding properties, I'm sure that more often than not a Player won't be required in that class anyways
So you would keep the properties stored in a hashmap instead
I see your point
But I believe it would be fine to have a reference to the player object itself right?
or would you always read the properties from the hashmap?
When required, you'd fetch them from the map, yes
Pleasure
What are some good hosting platforms for servers? I had a $9 plan with MCProHosting, but I'm considering switching because I see a lot of other platforms that have cheaper, yet higher quality services.
I'll check it out
Very cheap as well
Currently got our main server (16gb) running on them for about $24
ggservers was ok.. better than mcprohosting 😂 they were dead except for their support
Is there a way to allow spawners to spawn mobs over water in spigot?
i made a little test farm but the mobs dont spawn
@inland depot I think that should work though, but it needs to be dark? Otherwise you could try to place som eslabs
@bronze marten it didnt work
do they need to be on a special Y level mbe? honestly no clue how spawners work lol. Afaik, my players could just have such spawners where spiders were falling out of the sky
dont think so
i've done this before and it should work
but before i recode the spawning system i'd be curious if there's a simple fix
@subtle blade sorry to bother you but do you have any idea if there's an easy fix to my problem?
for some reason .getClickedInventory doesnt want to register and yes, i ahve imported org.bukkit.event.inventory.InventoryClickEvent https://gyazo.com/f0aa75301569ce278dcd1c762e932077
what version?
1.12.2
interesting
I had some bug like this as well in intellij, try this:
For me it didnt recognize classes in the same package
you must be using an old bukkit api
That's a Spigot method
You guys wouldn't happen to know how to use custom items in custom recipes would you? Like items with their own meta I can't seem to figure it out
Oh I lied, it is Bukkit ;P
Last I recalled it was Spigot-exclusive. That may have been the case in 1.12.2
@late wyvern let me see your pom
It's Bukkit in the latest version, though I remember that being Spigot-exclusive at one point
I'm 95% sure a library you are using is using an older version of the api
1.13
1.13.2, yea
yeah
😛
that day
it was just transferred
Why are some methods still spigot exclusive?
Because Spigot is the successor
Core functionality is targeted to Bukkit but most performance-related functionality is driven towards Spigot
Bukkit is considered mostly legacy. It's maintained only so Spigot can build upon it
what can i do about it then/
should i just use 1.13.2?
fixed it when switching to 1.13.2 thanks guys! you are the best!
Is there a way to appeal to be able to report?
Im sick of this kind of people https://prnt.sc/sj9hxw
Is there any way to appeal the report button so i can use it
Because i can't report anyone rn
That’s horrible
mind if I ask what plugin?
Search up minkizz
yeah xD
is it possible to get rid of the beginning [15:06:22] [Server thread/INFO]: in println?
aight
How can I get an OfflinePlayer but only from server cache (without calling the API)?
Bukkit#getOfflinePlayer(String name) is deprecated so I don't want to use that
And AFAIK it's deprecated because it calls the API and it's blocking
Bukkit.getOfflinePlayer(uuid)
that?
just store the uuid of all the players who join your server, then you can punch in the string and get uuid, then the offline player
@pastel fox
@pastel condor doesn't Bukkit already store them though?
Yeah I want to fetch by username from a command
I guess if nothing else I'll store them too
so.. Just ran build tools 1.8.8 and when i try run ```code
java -Xms2048m -Xmx4096M -jar spigot.jar -nogui
PAUSE
when you try to run... ?
it prints https://sourceb.in/acb26c5476
yeah the server jar
when i try run the server jar it just prints this shit
what
SEVERE: 'n' is not a recognized option it prints this
but no where in my command script does it uses n
ohh
nogui
wtf
Strange oh well its solved
stupid error ig
@brisk mango Any idea why that final Player player = event.getPlayer().getKiller(); is throwing an NPE on InventoryOpenEvent
I need the player object to message but thats obviously not happening
Apparantly "player is null" due to my debugging but its not lol
nvm im stupid, realised LivingEntity is part of a superclass so i can access the method I need from LivingEntity
I wouldnt use Player#getKiller @fathom shard
because that doesnt return the actual killer
for example, if a zombie would hit you and you would drown it would return zombie as a killer
Nah i realised LivingEntity inherits the CommandSender's methods
so i can actually fetch the method i need from that
ah fine
Can someone ban this guy?
I can't report because i don't have the report button
Btw whats the way to use "PlayerPickupItemEvent" as it says its deprecated
hi
i added the prefix for the default player but the prefix dont work
this is luckperms bungeecord
with no chat plugin, great lol
so if i have map.merge(key, value, (object1, object2) -> {}); is object1 value or is object2 value?
that shouldn't compile
any chat plugin that supports vault prefix or luckperms
nvm i just noticed i have to use EntityPickupItemEvent
it should be a bifunction
its bifunction
object1 and object2 are both of the same type as value
ah I never honestly used merge method
so i need to install the plugin in every spigot server or just the bungeecord server
any chat plugin that supports vault prefix or luckperms
@cloud crater
no
@finite belfry just use the luckperms discord, they will help a lot more
one of them is the new value i set as value
dm me if you need a invite
the other one is the current value in the map
your operator should be commutative so it shouldn't matter
ok thx
as it happens the first one is the value in the map
is that consistent?
see "Implementation requirements"
V newValue = (oldValue == null) ? value :
remappingFunction.apply(oldValue, value);```
so oldValue is passed as the first argument
also - looks like i'm wrong about it being commutative, not sure why i though that
yeah it being the first value is well defined behaviour
Hello, I am using a YamlConfiguration to load data, and I am serializing a location by joining the x,y,z, and world uuid with a semicolon. When I load it in, the second string location it encounters only loads the first few digits. This is my location deserializer function:
public Location locFromString(String loc) { String[] vars = loc.split(";"); double x = Double.valueOf(vars[0]); double y = Double.valueOf(vars[1]); double z = Double.valueOf(vars[2]); return new Location(Bukkit.getWorld(vars[3]), x, y, z); }
double y = Double.valueOf(vars[1]) produces an index out of bounds exception
This is my loading function:
this.game.chests = new HashMap<Location, ItemStack[]>(); for (Map.Entry<String, Object> c : (this.game.config.getConfigurationSection("Chests").getValues(false).entrySet())) { this.game.chests.put( this.game.locFromString(c.getKey()), this.game.deserializeInventory((List<Map<String, Object>>) c.getValue()) ); }
On bungee how could i disable the send message?
@grand aurora why dont you just save the Location Object as a whole
Because I need to serialize it to store it in a yml file
Oh you're using YamlConfig
if you use FileConfiguration you can use FileConfiguration#(path, Obj) and it serializes it for you
rather than having to split it yourself
YamlConfiguration inherits from FileConfiguration
On the forums, someone told me to do it this way because I don't think location auto-serializes. My problem is with loading it from the configuration file. The data is there, but only some of it is loaded.
And Location is ConfigurationSerializable
How do I serialize location through the built-in methods?
getConfig().set("location", location); //serialize
Location location = (Location) getConfig().get("location"); //deserialize
Thanks!
You have to always cast it to the a ConfigurationSerializable object to get it from the config file.
I personally prefer gson as it is much nicer to serialize encapsulation classes.
How can I get data from the api using javascript?
Thats what I've been trying so far:
const cheerio = require('cheerio');
const request = require('request-promise');
async function init() {
var url = "https://api.spigotmc.org/simple/0.1/index.php?action=getResource&id=78993"
const response = await request(url);
console.log(response)
}
init();
it gives me errors because of cloudflare so... how can I use the API?
How would I be able to get an ArrayList of locations from the YamlConfiguration this way?
@velvet halo getLocation()
No need to get() and cast
Anything from Bukkit that is configuration serializable has its own getter
Anything else can use getSerializable()
oh 😮
@grand aurora
Locations:
loc1: "50 20 12"
loc2: "40 20 10"
and then with getConfig().getString("Locations.*") or something like that i guess?
I didn't know getLocation was serializable
Okay, thanks
@subtle blade help me with the API ;_;
You need to declare a configuration section if you want to get an array of locations. Choco sent java docs already
If you're being blocked by cloud flare, supply a user agent (though you should be supplying one anyways)
If you're still being blocked, create an issue on the GitHub
I am finally happy with handling my claim data but I need to know if this is a good way todo it >.<
public class Claim {
private final long data;
public Claim(Chunk chunk) {
data = convert(chunk);
}
public boolean equals(Chunk chunk) {
return data == convert(chunk);
}
private long convert(Chunk chunk) {
return ((long) chunk.getX() << 32) | (chunk.getZ() & 0xFFFFFFFFL);
}
}
I am handling the claim data with a map. UUID as a key and a set of claims as a value
So you claim... Chunks?
Yes there are negative values when serialized in json
Also chunk.getZ and oxffffffff shouldn't do much
wdym?
x and z are integers
They are ints, yes
That's truncating 24 of those bits
Though I'm curious as to why you're truncating them?
You have x and z, both are 32 bit values, right?
They can both fit into a long comfortably
Just shifting x should be right
^
Oh yeah hmm
((long) chunk.getX() << 32) | chunk.getZ()
Yea
Sounds good!
However, question
Why aren't you just holding the x and z values? lol
It's not like you're sending this claim data over a network, and even if you were, sending the values individually wouldn't increase network congestion at all
I just setup bungeecord, and when I connected to my spigot server it was like there was no player data. No death counts, inventories, etc
I know I am not sending over a network but I want it to format nicely in a json file.
What could cause this?
{
"c476c4bb-08bc-4c33-80b5-60af5cbd5945": [
{ "data": -34359738371 },
{ "data": -38654705667 }
]
}
Also definitely more readable
I'd also imagine file size will be marginally smaller
"data": -34359738371 vs
"x": 123, "z": 321
MARGINALLY
lol
xD
public class Claim {
private final int x, z;
public Claim(Chunk chunk) {
x = chunk.getX();
z = chunk.getZ();
}
public boolean equals(Chunk chunk) {
return chunk.getX() == x && chunk.getZ() == z;
}
}
``` Yeah you are right
lol
and yes I could do two vectors for claiming
Yes
but I honestly like the feeling of just having it chunks
Chunks makes sense to me
Can chunk be null?
what do you mean?

