#help-development
1 messages ยท Page 1518 of 1
if ur using maven its easy just change the version to 1.17-R1-SNAPSHOT
?bt
Is it possible to put different music to different biomes with the mods?
and u get the spigot api
dont multi channel please
only talk in one
;-;
yes but I try to be answered I have to program and I try to find mods for it
yes but u can play sounds to players which is server sided i think
The ambient music itself is client side.
most music is ambient
the mc music in game and such is ambient and stuff
Some people refer to the music and sound effects interchangeably so I like to be sure.
yes but I make a server modeled with dragons and I try to put fantastic music by biomes.
u can change music i think with a resource pack
with spigot?
i believe with mods u can change resources also but idk
someone know the skin byte for 1.17?
I have a lot of ShapedRecipes thaat i used Bukkit.addRecipe on in one function insidde a class. if i made another function in the same class and removed the recipes using the namespaces i put inthe first function, would it work
for client settings?
In 1.16 it was like that
DataWatcher watcher = npc.getDataWatcher();
watcher.watch(10, (byte) 127);
i want enable second layer for skins
@granite stirrup
yes is what im using, it was like that before but not work
anyone know like a thing to make players go into crawl action? in 1.16.5
u have to play the specific packet for the player
alrihgt
Can anyone help me with this? I'm making a plugin for 1.17 that removes villagers when a chunk is loaded in, but it doesn't do it. The lines of code seem simple enough to me but I am a newbie so I guess I'm overlooking something?
e instanceof Villager
Class::isAssignableFrom and Class::isInstance is for when the class in question is a variable
in your case, it is always Villager
so you can simply use the instanceof operator
is there a way to remove the black sky that shows when a player goes below y 61.38? i swear i saw someone talking about removing it server-side
uh
change the world type to superflat
iirc that somehow causes the sky to only change below y 0
i'm a pretty correct guy
thats why you have hitler in your avatar
the most correct man in human history
Like this correct?
no, you're testing if the event is an instance of Villager
test if the entity is an instance of Villager
also jesus christ what is up with your brackets
Ah lol, I'm blind, and yeah I'll clean that up lol, thanks for the help
how do i check if a recipe has been added/exists?
Bukkit.getRecipe()
is there some non retarded way of taking a WALL_PLAYER_HEAD and changing it into a PLAYER_HEAD without nuking the texture and other tile entity data
get state, set block and update state?
wouldn't that set the block type back to a wall head
or just refuse to update it
i'll try it and see i guess
oh btw, the down one is what my server displays, the above is what I want it to display when I ping the bungeecord to be exact.
can you hear me?
where am i?
do you want to kiss
how can i read a CustomCraftInventory out of a string to open it again ?
older than you for sure!
guyys pls
i think we should kiss
ewwww
homophobic huh?
you're what I call a wierdo....
You can't be homophobic in June
The man is acting based
can someone help me ?
uhm
I didn't get your question at all... just saying
U cant
what kind of inventory do i need to open it again ?
U have to open new one with items and make sure there's no dupe glitches
cant i just open it as the string with contents ?
is there any other way to get player cps
im based af!
other than dividing clicks by the amount of selected seconds
who fkn ghost pinged me
thats literally what cps is?
no, spigot doesnt hand you a getCPS() method on a silver platter
and if it did, that would literally be how it works
i wanted it to show the player's cps every 1 second
then youd need to regs=ister a whole bunch of PlayerClickEvents
i just did this instead
public static int getClicks() {
Iterator<Long> iterator = clicks.iterator();
while (iterator.hasNext()) {
if (iterator.next() < System.currentTimeMillis() - 1000L) {
iterator.remove();
}
}
return clicks.size();
}
clicks per second ...
no you dont
wtf
not sure if this is an efficient method but it works fine form e
but you need to register clicks
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
public class ClickListener implements Listener {
@EventHandler
public void onPlayerClick(PlayerInteractEvent event) {
if (event.getAction().equals(Action.LEFT_CLICK_AIR) || event.getAction().equals(Action.LEFT_CLICK_BLOCK)) {
Cpstest.addClick();
}
}
}
you only have to register the event once in onEnable()
wdym
that is wrong on so many levels
== pls not .equals() or well thats what i do anyways
static method wat da fok
no you just drop a bunch of playerclickevents in a class and register the class
lol
or you can just put it in one playerclickevent
is there any tutorial over here to port a plugin from 1.15 to 1.16?
there's not much to do when porting a plugin
u just change the version of the plugin and update any api bits that need to be
but like
Uhh Hi I'm back So, I have super(EntityTypes.ZOMBIE ,((CraftWorld) loc.getWorld()).getHandle());
But, in the new 1.17 update, it is not working what should I use instead?
how to fart on plugin in 1.17
where do i find it?
find what
compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT'
the latest 1.16.5 of this
what class are you importing
as an example
change it to 1.17-R0.1-SNAPSHOT
instead of 1.16.5
put 1.17
that's it
xd
even if I want it to be 1.16.5?
yeah
just keep it 1.16.5
ur good like that
and then if there's no errors ur fine
not much api changes usually i think
thought the snapshot was an older version somehow
what do i do
Uhh the only import I see is import net.minecraft.world.entity.monster.EntityZombie; Also, i need 1.17 for A server I'm coding for
i think he's probably pointing out the static and the .equals instead of ==
How does one add permission
are u extending an EntityZombie class
if (player.isOp)
if ur in intellij go ahead and just ctrl click EntityZombie
and it'll open up the original class
then just check the constructor
that's the parameters you need
no like permissions
- enum comparison with .equals instead of ==
- Naming convention of Cpstest
- Static methods for classes that should have state
- No management for other players, will fuck up if theres more than 1 player
I dont want player to be OP just to be able to only allow some players to buy sh*t
declaration: package: org.bukkit.permissions, interface: Permissible
using OP when making a plugin is a very bad idea
Player is a child of Permissible
also can we talk about why you are manually creating an iterator
therefore it'll have addAttachment
ok
I'm trying to
ctrl click EntityZombie and look at its constructor
I'm just trying to make a costom mob
idk why you need to use nms for custom mob
here is how I do it @keen kelp
https://github.com/hawkfalcon/ServerTutorial/blob/master/src/main/java/pw/hwk/tutorial/enums/Permissions.java
unless you are talking about adding permissions yourself instead of letting a permission plugin handle that
how to know if a player has something in the offhand or not ?
check their offhand
I want costom AI and drops and stuff
declaration: package: org.bukkit.inventory, interface: PlayerInventory
no I just want to add a permission to be manages by a permission plugin
it's either check if it's null or material is air
that's what I'm doing but it goes thru
the if
are you checking if null
spigot/bukkit is weird, sometimes it's null sometimes it's material.AIR
the link I gave you is how I check permissions then
I literally even check it 2 times
if null || air
thx
{
ItemStack offHand = e.getPlayer().getInventory().getItemInOffHand();
if(!(offHand == null && offHand.getData().getItemType() == Material.AIR)) {```
The only constuctor is the one I showed you
you're checking if it's not null and then checking if its not air
why you gotta make it so verbose
lol thanks
that's not your constructor look at EntityZombie
.equals() is for comparing values of an object iirc
the compiled jar isnt even loading
== is to check if it's the same memory location
check console
it doesn't just not load
there has to be an error
one second let me switch off remapped

I am still confused as to how bukkit knows the permissions
WTH IS https://your-mom-is.taahyt.com/
like how do you register the perms
yes
lmao
permissions aren't registered into bukkit
well
u can use
I'm guessing in the permissions.yml
bukkit's perm system
but a permission node doesn't have to be valid
u can have some bs like
dumb.person
but vault does it all for u anyways
and it'll still be valid
plugins usually handle perms themselves
for where they're stored - maybe vanilla mc ?
have no clue
probably vanilla mc since vanilla mc also has a perm system
wait so what permission systems do other plugins use
they use vault usually
hook into vault's api and mess with that
if you really want to
your perm could even be like ```gamemode1
and vault registers perms?
or if you use luckperms you can just hook into their api
yes
vault is more of an
api
from my knowledge
i don't think it actually does anything itself
hm
this sounds way less clean than I thought
ah yeah
it does
i see
yes
ye perms are pretty messy
VaultAPI directly does sh*t with the server itself yes?
without relying on anything else
what do you mean?
like would it would with just VaultAPI
vault api has to be hooked in to
it has to have some kind of plugin that implements it
so I have to ask users to add in Vault as a plugin
people that make perm systems with vault usually implement their permission class as its own thing
for example if you want to do SQL
shading it in would be fine?
ok
ok
Is there a way so that no matter what plugin the end user uses, the permission system would still work
and in your plugin that you are coding
yeah it shades it into vault i think
public static Economy econ = null;
public static Permission perms = null;
public static Chat chat = null;
public void createHooks() {
if (!setupEconomy()) {
Core.plugin().getLogger().severe("Vault was not found!");
getServer().getPluginManager().disablePlugin(Core.plugin());
return;
}
setupPermissions();
setupChat();
}
private boolean setupEconomy() {
if (Bukkit.getServer().getPluginManager().getPlugin("Vault") == null) {
return false;
}
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
return false;
}
econ = rsp.getProvider();
return econ != null;
}
private void setupChat() {
RegisteredServiceProvider<Chat> rsp = getServer().getServicesManager().getRegistration(Chat.class);
chat = rsp.getProvider();
}
private void setupPermissions() {
RegisteredServiceProvider<Permission> rsp = getServer().getServicesManager().getRegistration(Permission.class);
perms = rsp.getProvider();
}
}
like hypothetical situation where the user doesn't use vault and their perm plugin doesn't support vault either
the users don't need any plugins
is there a way to still have permissions work
it's all server side
ur hooking into vault itself
I mean like ppl using the plugin
when u use vault api you can either:
create ur own implementations
and set vault's permission system to urs
or
you can just use its api normally i believe
i dont use vault a lot
dont see much point tbh
just an api to make stuff easier
meaning a lot of what im saying could be wrong lol
but like what does the API act on
guessing you use plugins like luckperms?
ye
nice
ikr
yes
PermissionEX is og
wait so VaultAPI is an ecosystem or just a tool
does it store the Permission in a custom place and other plugins that support vault read the same place
or does it do stuff directly to bukkit/spigot and other plugins just read that
I just want to know how the system works
oh i see
permission plugins register the permission to bukkit, the utility I linked you is just an easier way to check perms without doing a bunch of if checks
i see what u question is
so you don't need to hook vault in any other plugin as Vault registers perms with bukkit directly
to check if a player got the perm u want
yep that's my question, thanks
do player.hasPermission("permission");
my utility for permissions pretty much does that, just allows for checking multiple permissions even * ones without much fuss @quaint mantle ๐
you made one?
damn big boi
its open source, feel free to use it
cool now make it into an API
Hawkfalcon isn't me, but I own Server Tutorial ๐
if I use VaultAPI(without shading it in) the user would have to install vault correct?
ermmmm
it's only like 100kb I can afford to shade in that with minimising
if you do, relocate it
in case someone does have vault in their plugins directory they won't conflict
you gon make an api outa that?
No, its just a utility class for permissions that I don't mind sharing with people
it makes it easier to do permission checking, even dynamic permissions without implementing if checks everywhere
Spigot is the only dependency in which being shaded in is completely unnecessary
and not advised at all
since it wouldn't update with spigot unlike server.jar?
it just sounds like a shitfest tryna shade Spigot in
alright goo'night y'all
gn
Just because you shade spigot doesnโt mean you can launch it
that is one reason, but as you said earlier unnecessary and just causes your jar size to bloat too
yep
cya later Frenzy
actually does bukkit still exist by itself?
like is there a bukkit server.jar that you can run for servers?
or since Bukkit is only kept alive by spigot devs no individual builds of bukkit exisis
you have to compile it yourself, but it still exists in the directory for buildtools though for you to do so
Bukkit/CB is still used since spigot is based off it
lmao I still love the description of the github repo for shadow
Gradle plugin to create fat/uber JARs, apply file transforms, and relocate packages for applications and libraries. Gradle version of Maven's Shade plugin.
ah yes, fat/uber JARs
I don't use gradle, so if you need help with that I am not the person to ask. I stick with Maven ๐
it's fine Ive done shading before ;)
how does file io work for spigot?
I want to add in some settings
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
On vanilla minecraft, a creeper or fireball with a negative ExplosionRadius NBT will knock back entities but not do any damage. However, with spigot, explosives that have negative ExplosionRadius values do NOT knock back entities.
Is this intended? If so, why? If not, can it be fixed?
it's more like an inaccuracy
something that's not the same as vanilla
if you want, make your own explosion :)
also if you want
you can summon a regular fireball/tnt with some PDC
declaration: package: org.bukkit.event.entity, class: EntityExplodeEvent
just do event#setcancelled(true)
if the exploding entity has your PDC
@spring yoke hope this answers it
actually Im not quite sure the cancel event thing will work XD
the reason this is most likely the case is because what you described is actually a bug as well as negative values are not expected, thus when you input a negative value using spigot odds are it is just turning it into a positive number and thus not giving you the result you expected. This isn't broken so there isn't anything to fix, the best you could do is to implement knockback yourself.
yeah it's more of an implementation flaw, less of a bug
either create a normal fireball/tnt and cancel the block breaking event
(if you want players to see it)
how do i disconenct a player with the Failed to connect to server message instead of the Connection Lost message
or just skip the middleman and apply the velocity directly
spigot turns the negative into a 0
just player.kick("Reason")
that would say Connection lost
wait rlly?
yeah
no I use the negative explosion radius to avoid hurting people, not breaking blocks.
no, it should say the reason
oh
I was going to say that just wasn't sure, however same principle applies. Simply because negative values are not expected in the NBT, the way it was coded in spigot was simply to ignore negatives then.
and it also makes the visual explosion much smaller
then use EntityDamageEvent
when do you kick the player
on join
and the knockback is stronger than the equivalent positive value IIRC
look some server do this
and if the entity damaged is player and the thing that's damaging them is a fireball/creeper with your PDC, cancel it
when they join
no idea why it'd do that
you can even try banning
and it'll do the same
and the message only shows when they rejoin
not sure why that happens
ye, i have no idea why that happens
have you tried player.disconnect()
let the player load in first
wait
nvm
@valid totem try kicking the player after something like 10ms
and try using postloginevent instead of playerjoinevent
yeah I feel like that's whats happening
you need to let the player load in first
if it still says connection lots then increase the delay
use a scheduler
the client sees the connect being lost right after it started and just assumes its a network problem
What is going on here
or something of that sort
typically something along the lines of
new BukkitRunnable() {
public void run () {
. . .
}
}.runTaskLater(plugin,delay)
or whatever the method was
they're tryna kick players with a message and it just says Connection lost
he's kicking the player too early
als owith PostLoginEvent use player.disconnect(), not kick
you won't be able to kick them because they haven't joined yet
hmm
ima try that
It lets you specify a message
no, the thing keeps saying connection lost
it's because they aren't letting the player load in
even if you specify a reason
also, it's best to use the postloginevent, especially if the player has a bad connection
with postloginevent it's guaranteed that the player isn't able to see anything iff that's what OP intends
try joining a server with a bad download speed and you'll notice there's gonna be a lag spike upon joining
guy I think my plugin.yml isn't doing so well
wdym
can't explain it well
translation:
Lag breaks everything
That method is designed for this exact purpose
If it didnโt work someone would have noticed by now
i was being dumb and didn't notice at first that you were pointing out the disallow method, my bad
i thought you were just bringing up the event in general, and not the disallow() method
sorry about that
Ticks = MS / 50
Yeah but
that would be nightmare for future me
if I were to abandon it and come back
its not quite right because a tick is always at least 50ms
20 ticks per second = 20 ticks in 1000ms or 50ms per tick (which is ideal)
GameMode.toString gets the name of the game mode?
mspt is basically an inverse of tps since the former is time per tick and the other is tick per time
so it's more like MS/50 and ditch all decimals
yes i think
kind of
i mean it depends on if you're talking about real game ticks or not
you could talk about the theoretical tick that is less than 50ms
Im tryna simulate lag here
In terms of code, itโs 20 ticks per second
simulating high ping
In game, it can be lower in theory
yes
and ticks do take less than 50ms to compute a lot of the time, the game just sleeps for the rest of the 50ms
but if you want to simulate lag you dont need any of that
if you want to simulate for example 10tps then you need 10 ticks per second... so make sure that each tick takes 100ms (double the amount of time it should)
Honestly Iโve never tried delaying a packet
not sure how you would simulate that but theres probably a way
But you can sure try
not sure why you would want to do that
does the intention matter?
private void setGameMode(Player player, GameMode gameMode)
{
player.setGameMode(gameMode);
player.sendMessage(Color.GOLD + "Your game mode has been changed to " + Color.RED + gameMode.toString());
}
let's pray this works
is it possible to override the vanilla ban command
and replace it with another command made via plugin
Yes
is it the same way you would create a command
or do i have to do a few more things?
That should work
alright
If it doesnโt you can intercept the vanilla one with PlayerCommandPreProcessEvent
pretty sure registering ban is enough lul
I registered /plugins and it did not override the spigot version ยฏ_(ใ)_/ยฏ
but vanilla vs spigot
weird, wonder how plugins like the one that hides your plugins when you do /plugins did it
gonna be trying preprocess then
ty
.
To be fair those plugins are dumb anyway
it is going to be hard to simulate high latency due to the fact that high latency is generally caused by distance. But in order to simulate it you would delay the packet being sent but have to pay attention to what you have your socket time outs set to. The default usually is 30 seconds without a response before it is forcefully terminated. If you are only delaying just a particular packet you can generally delay it as long as you want as long as you don't delay the ping packet from client and server.
i admire how duly written that is
KeepAlive is the important one
is fine
Im prob not gonna delay it for more than like 1 second
hmm
java.lang.NullPointerException: Cannot invoke "org.bukkit.plugin.RegisteredServiceProvider.getProvider()" because "rsp" is null
VaultAPI
you need to assign a value to RSP
RegisteredServiceProvider<Permission> rsp = getServer().getServicesManager().getRegistration(Permission.class);
I did
and I dont understand how this function can return null
Do you have a perms plugin installed
if you are doing it in the onEnable, you need to wait for all the plugins to finish enabling, second you need a permission plugin. Vault is a bridge API
I mean I guess you can shade it, but itโs pointless since it needs to run as an actual plugin
Yeah most API plugins are not made correctly ๐ฆ
i remember someone saying VaultAPI acts directly on Bukkit so I dont think that's necessary?
but Vault is an exception however since its goal is to bridge economy and permission plugins into a single API
Frenzy said yes so Il ltake it as a yes
Regardless, make sure you have vault installed and set it as a depend for your plugin
Yes, but how can I cast to block in inventoryholder?
why would you do that
are you saying to me?
yes
because I want to make lock
If you lock one part of the chest it's automatically locking the other.\
OH wait
I found solution
like
InventoryHolder rightChest = doubleChest.getRightSide();;
TileState leftState = (TileState) leftChest;
TileState rightState = (TileState) rightChest;```
thanks you everyone
Hello, I have the class
package me.Towster.Enchantments;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
public abstract class SmeltingTouch extends Enchantment {
public SmeltingTouch() {
}
public boolean canEnchantItem(ItemStack item) {
return item.getType() == Material.WOODEN_PICKAXE;
}
}
And I need the values for the constructor.
I've tried super(200) But it said that The Enchantment was undefined
oop Alright
can anyone go to help-server
How would I make the NamespacedKey
I am aware that we aren't meant to be asking about 1.17 here, but are there any known issues in regards to custom chunk/world generators? I'm having an issue with a generator that works on 1.16 to do with a Class Cast Exception
net.minecraft.world.level.block.state.IBlockData cannot be cast to class net.minecraft.world.level.block.ITileEntity
But I at no point do that within my own code.
* Please do not ask the about 1.17, see https://www.spigotmc.org/ instead
I think you confused the not asking part with not asking about an ETA for release. You are more then welcome to ask about 1.17 though ๐
It's a basic skygrid generator, so it does nothing fancy
It did do chest populating but that code is commented out
?paste the full error, maybe?
that looks very much like a vanilla problem but idk
My own conclusion was it wasn't an issue in my own code, but I'm not a professional, so I figured I'd check.
Could someone please send the link to java 16
?java16
Install Java 16 at https://adoptopenjdk.net/?variant=openjdk16&jvmVariant=hotspot
does your plugin mess with chunks ?
think you are probably doing something async that shouldn't be
but I can't confirm however since I don't know/see your code so you would have to check that
this might be a stupid question but is there a way to figure out why a chunk was loaded? Like which player loaded it?
check for players nearby?
just check what your view distance is, and you will know how far a player must be to cause the chunk to load for a player
ChunkLoadEvent#getChunk().getEntities() ๐คท
that isn't going to work
figured
ahh
Players will generally cause the chunk to load before they get close enough for that method to work
unless view distance is set super low
to give you an idea
view distance 10, means 400 chunks will be loaded around each player
right yeah, so im just gonna take the chunk x&z from the load event, multiply it to get block coords and then do a scan around that for players, right?
pretty much
with a view distance of 10, you would need to check at least 20-21 chunks away
yeah, view distance of 10, means the square around the player is 20x20 chunks
go to help-server
Hello! How do you make custom recipe using itemstack? (I'd also like to determine the quantity of items I need)
I know I have to use events, but I don't have any tutorials.
RegisteredServiceProvider<Permission> rsp = getServer().getServicesManager().getRegistration(Permission.class);
currently returns null, what do I do
Permission is in VaultAPI so it should've be missing
That isn't the permission class it is looking for
it is looking for the permission class from the permission plugin
if the plugin loads after your plugin does and you don't wait to check it can return null even though a permission plugin exists
but I dont want to specify a permission management plugin
then not sure what you are attempting with Vault
Vault bridges between your plugin and the various permission plugins without having to set all those permission plugins as dependencies
if there isn't a permission plugin detected, then vault isn't going to do anything for you
so you need to code your plugin to handle when a permission plugin isn't present
Like I dont want to specify a single permission plugin to be used
I want it to support most if not every
I don't think you are reading what I or others have said
I did I just didn't understand
if you are trying to test your plugin you need to have a permission plugin on the server
so that Vault can interface with it
otherwise, Vault has nothing to interface with and will do nothing
I was told by someone the Vault Interfaces with Bukkit and perm managers just takes it from bukkit
I am not aware of Vault interacting with the basic perms system
the basic perms system is an all or nothing thing
is that so?
either everyone has the perm, no one has the perm or only ops of certain levels has the perm
but like VaultAPI adds the permission to bukkit right
like it's still possible to add permission without a permission managing plugin
ItemStack hgaxe = new ItemStack(itemManager.smallAxe);
ShapedRecipe hga = new ShapedRecipe(hgaxe);
hga.shape("ggg", "gag", "ggg");
hga.setIngredient('g', Material.GOLD_BLOCK);
hga.setIngredient('a', Material.NETHERITE_AXE);
getServer().addRecipe(hga);
``` So there is a strike through the new ShapedRecipe, saying that it is depricated, ( using IntelliJ ) will this cause errors? i'm moving my recipes to a seperate class exact same code, but now get this.
Ok lemme reask this question: a permission plugin doesn't need vault to manage permissions yes?
If it's deprecated check the docs to see which method has replaced it
You need to specify a NamespacedKey as the first argument
.
permission plugins don't need vault, no and most plugins don't need to interact with permission plugins directly either
I've probably used a NamespacedKey before but just probably didn't notice, what is it? whatever I want it to be?
and if I manually add a permission to Bukkit
Yeah it's basically to add a name to the recipe
the permission manager can manage it without vault
oh yes, and this could possibly help me add it to the recipe book as well?
you can register a permission with bukkit using its API, but bukkit isn't going to remember it between restarts. Hence why we have permission management plugins.
ItemStack hgaxe = new ItemStack(itemManager.smallAxe);
ShapedRecipe hga = new ShapedRecipe(new NamespacedKey(plugin, "Name of the key"),hgaxe);
I don't know about that sorry
if all you are going to do is interact with the permission api, then you don't need Vault
I just want to create a permission
just to have it exisit
to be managed
just a permission to exist and make features only available for players with the perm
The API doesn't do any of the managing at all, that is why permission plugins exist. But you don't need a permission plugin or vault, if you are going to interact and manage permissions in your plugin though
I dont want to flood help-dev can I take this to the dms
you are not flooding it
just I am not entirely sure what exactly you are not understanding is all =/
ok so
I can draw out diagrams if that helps lol
what is plugin suppose to be in this instance ?
Your plugin's main class
oh lol
a reference to it anyways, few ways you can do it
wait now im confused, so my main class is LuwizSystems. I put that as a replacement for plugin, and getting red underline, to make a maven dependancy and or create a field in recipe class.
hmmm
i forgot how to do that lmao
My mental model rn is
Plugin ===[Registering permission]===> Permission Pool(Think of it as a box) ===[Given to]====> Players
and permission manager stands
Plugin ===permission===> Permission Pool(Think of it as a box) =[here]====> Players
and vault stands
Plugin ===[here]===> Permission Pool(Think of it as a box) =[Given to]====> Players
but from what everyone's telling my confused ass, it looks more like this
Plugin ===[VaultAPI]===> Vaullt's Own Permission Pool(Think of it as a box) =[Permission manager]====> Players
Maybe LuwizSystems.class
๐
nope
Hey I am trying to use eclipse to create a spigot 1.17 plugin ;
https://www.spigotmc.org/wiki/creating-a-blank-spigot-plugin-in-eclipse/?noRedirect=1 I am stuck at:
2) Create a new project; at the "Select Finish";
https://i.imgur.com/WBvnSOf.png Errors occurred during the build. Errors running builder 'Java Builder' on project 'fuckYou'. For input string: "G" under radix 16
I use java 16 the same version that minecraft vanilla server and client for 1.17 requires
it doesn't work with 8/9/11, so I assume the development of spigot requires java 16?
@wet breach is the model correct?
cause Im really confused and I just need to reorgannise
just take a main in your constructor
and when main calls it pass this to it
ShapedRecipe hga = new ShapedRecipe(new NamespacedKey(LuwizSystems.getPlugin(LuwizSystems.class), "Name of the key"),hgaxe);
``` i just did this and no underlines... i was just playing around with getPlugin and came up with this
Try it then :)
almost
with Vault
plugin --> VaultAPI --> Permission Management Plugin --> Spigot Permission registration/API
if you don't have Vault or a Permission Management Plugin its
plugin --> Spigot Permission Registration/API
There isn't exactly a pool of permissions unless plugins provide it in their Plugin.yml and in that file dictates if its for ops by default or for everyone by default. The Permissions.yml file in bukkit is used to override these permissions in that file on what their defaults are.
allright I will try to follow it with intellij or netbeans then
So bukkits permission system is very basic
there is an API to register perms to players, but your plugin has to do it
the API doesn't check if a player has perms, you have to check that
so I can't register a permission without a permission management plugin?
You can, just bukkits system isn't going to do stuff for you
it will just keep track of that permission exists
so you can use API methods later to check it
I mean you could tie plugin.yml commands to a specific permission
but how it the permission assigned to players
In the API, there is a method to tell Bukkit to assign a perm to a player
I mean like in the Flow
like after Spigot Permission registration API, does it put the permission in the "pool"?
suppose pool is where every single permission lives
event.getEntity().setHealth(getConfig().getInt("Zombie-Spawn-Health"));
event.getEntity().damage(getConfig().getInt("Zombie-Damage"));
``` Would this be how I set health and damage? or would I use an attribute
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/permissions/Permissible.html
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/permissions/Permission.html
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/permissions/PermissionAttachment.html
declaration: package: org.bukkit.permissions, interface: Permissible
declaration: package: org.bukkit.permissions, class: Permission
declaration: package: org.bukkit.permissions, class: PermissionAttachment
Set health sets the current hp up to the max hp set by an atrribute. Damage deals damage to the mob
As I said the API for the permission stuff is very basic, once a permission has been created and you assigned it to a player, the Player object will contain the permission for said player.
so setHealth 40 they have 40 health? and damage is what is dealt to the mob?
setHealth will usually cap at 20 because that's their max health
So use an attribute?
Hey I wanted to check how openBook works and here is the craftbukkit code
public void openBook(ItemStack book) {
Validate.isTrue(book != null, "book == null");
Validate.isTrue(book.getType() == Material.WRITTEN_BOOK, "Book must be Material.WRITTEN_BOOK");
ItemStack hand = this.getInventory().getItemInMainHand();
this.getInventory().setItemInMainHand(book);
this.getHandle().openBook(CraftItemStack.asNMSCopy(book), EnumHand.a);
this.getInventory().setItemInMainHand(hand);
}
But I'm wondering if this is really safe? What stops someone from writing a hacked client to automatically put the book in another slot as soon as the packet arrives? That way you'll get both the book and your own item back.
i want them to be able to change the amount of damage they can do
Should be fine
MyPlugin --- [VaultAPI] ----> LuckPerms ---- [Spigot's permission registration API] ---> "The pool" //Registration
LuckPerms ----> "the pool" ----> player.attachPermission or whatever //Assigning to player```
is that right
sex
I don't think that really answers my question.
I could've already assumed it's fine without knowing the second part that I asked, but I'm here to make sure, not assume anything.
You don't really need that book though
I'm not sure what you mean by that.
Just send a packet this way you will avoid all of your worries
I could've already done it differently myself yea. I'm asking why the formal API is not doing it differently.
yeah seems like it, except not sure what the bottom represents, but the top part to //registration seems to be accurate
the bottom one is when I want to give a player a permission
Mojang don't need anything else
My interpretation of "formal API" is anything that's provided by Bukkit/Spigot directly.
then yes that is accurate
for example I want to give them permission for bypassing chat filter
Not by mojang
It's not provided directly that's Mojang code
With a utility method from Spigot
and what if I have a permission manager that doesn't support vault
what will happen then
It is vault that supports the various permission plugins, not the other way around
also what I put in square quotes "[]"
stands for "by the means of" meaning there's other ways, this is just one way to do it
so it is true you could encounter a permission plugin vault doesn't support, because it wasn't included in its development to interface with it
craftBukkit as a whole depends on mojang's code. You're completely missing the point. You're just going off on a tangent at this point.
then what will happen
but in such cases you can just create a ticket on the repo for Vault to include support
So I feel a bit stupid reading through things again ;/
is it possible to register the permissions with VaultAPI
Generally rare to encounter a permission plugin that Vault doesn't support though
so if I dont want to register perms through a Permission managing plugin(through vault api)
I didn't read too carefully and assumed that was your code
Anyway what I said first is still true it should be safe
so it's more like
MyPlugin --- [VaultAPI] ---- [LuckPerms] ---- [Spigot's permission registration API] ---> "The pool" //Registration```?
It's ok. I was just trying to say you shouldn't answer things that you're not sure about. You might just confuse them instead. But yea, I'll probably wait for md5
if something in square quotes it means it can technically be skipped
for example I can just skip the permission manager and use VaultAPI to register a permission through spigt's permission api
also whenever someone catch a while md_5 please tell him to add a new help-development()
there's often two or more different threads going through here
no vault doesn't work like that. Vault only works to interact with the various permission plugins so you don't have to worry about every single permission plugin out there and its related api or absent of an api
event.getEntity().setHealth(getConfig().getInt("Zombie-Spawn-Health"));
event.getEntity().getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(getConfig().getInt("Zombie-Spawn-Health"));
``` Didn't work
Set attribute first
Then hp
set?
so if you are going to skip the permission manager plugin, might as well skip vault as well
this is the exact same way i did this for player custom health
so if I dont want to use a permission manager, vault is no use correct?
correct
Vault is a bridge plugin, if you remove what it bridges to, then it can't be a bridge no more ๐
and even if I skip them
the permission manager can still manage the perms I registered
since permission manager is like in 2 parts
real men build a bridge that leads to nothing
lol
and either way it's writing to the pool and the assigning part of the permission managing plugin is pulling from the pool
Luckperms ---> the pool ----> assign```
this workflow can also work yes?
since the pool is provided by bukkit
Not entirely sure if LuckPerms will detect the perms registered to a player via another plugin using the Bukkit methods and then do something about it
I dont have to go through a permission manager to register
i need your intuitive evaluation on something
technically don't, but generally wise to do so if you want the permission to persist
well this alone peeks my interest since generally don't ask me of anything o.O
i generally don't ask anyone anything
I thought "the pool" is global
you can register perms to anything that implements permissible
i've asked 3 questions in the last 2 months and received 0 answers
so even NPC's I think can have perms too
you mean assign or register
like a permission can just not exist for some player?
the pool is per-player?
anyway, the deal is that I need to iterate over a set of elements in a specfic order, determined by some property of those elements
reason I don't use the term Assign, is because the API doesn't assign anything. You tell the API to register your permission to whatever permissible object, and it will attach that permission to said permissible Object, whether it is a player or NPC
say, elements with a higher value will be processed before elements with a lower value
processing the set of elements mutates those elements, possibly changing the value of this property
and I do this repeatedly
please just use assign to differentiate between registering that it exists and a permission being "given" to an entity just to save my tiny wallnut brain
currently what I'm doing is iterating over a sorted list and then re-sorting it
but I was wondering whether it would be faster to use a binary heap to iterate through
and then heapify the unsorted result
well put them into an arrayList/Array and sort them
think you are probably doing something async that shouldn't be
but I can't confirm however since I don't know/see your code so you would have to check that
It's a world generator, so yes.
No, nothing is happening async. I've been writing plugins with Spigot and Spigot api for the past 3 years, I know all about not using the bukkit api async.
Just following up, I can see the conversation has moved on (I've been waiting for an opportunity to respond but this permissions conversation is going in circles for a long time now and I have other things to do today), just wanted to answer the questions. I'll disappear again now.
I was actually doing this the other day
heapifying an array is i think linear time if I don't remember wrong, but element accesses are logarithmic
where I had a bunch of lore objects that has to be turned into strings
and I want them to appear in a certain order
just had to make sure and lol
while traversing a sorted list is constant time but actually sorting it is n log n at least generally
O(Logn) time is what most of the methods are for Binary heap except for the get
myeah
get is O(1)
well, for the first element, anyway
well if assign them each a value, I have an idea
but, popping the first element involves restructuring parts of the array to maintain the heap property
to make it O(n)(I think)
and since I need to iterate over the whole thing, I'd be popping the first element each time until it's empty
you want to sort an array by each object's value right
i'm already doing that, but I'm wondering whether loosely sorting it into a heap would be faster
or is it a list
I can see a binary heap might be beneficial just looking to see if there is any other kind of collection that exists that might be better. Currently not seeing one lol
i can always implement it if it doesn't exist i guess, but I don't know of any suitable data structures off the top of my head
Well could make it similar to MultiValuedMap from Apache.
int i=0;
SomeMethod(i,true);
System.out(i);
public static void SomeMethod(int Number, boolean bool)
{
if(bool)
Number = 1
else
Number = -1
}
what would this code output
but not sure if that is going to have the efficiency you are looking for though
I am still confused to as to how java gives arguments to a method
Why would that be confusing
the output should be 1 right
it would output 0
i tried to benchmark it with some low effort solution earlier but results were inconclusive because the benchmark was shit
why?
i guess i'll have to rig up a proper benchmark later
doesn't java give the instance instead of a copy or smth
if you use =, then the old instance still exists
because you never re-assign i before you output to the console
you get what I mean
Just the particular field has a changed instance it now points to now
so I have to do like
int i=0;
i = SomeMethod(i,true);
System.out(i);
public static int SomeMethod(int Number, boolean bool)
{
if(bool)
return 1
else
return -1
}
this?
that would output as 1 @keen kelp
the difference is, like I said, that int is primitive
an array is not
an array is an object
not directly
java is pass by value
You will always have to do something like array[0] = value
when you pass the array to the method, what you are doing it passing it the value of the reference
which points at the object
the method then modifies the object
and any variable that also points at the same object sees those changes as well
so modifying in a method only works for objects
not true
here is another way to write that
int i=0;
SomeMethod(i,true);
System.out(i);
public static int SomeMethod(int Number, boolean bool)
{
if(bool)
return this.i=1
else
return this.i=-1
}
but the return value was never addressed?
fixed it
i think oop should be underlined more in java tutorials
Just do not do that with static fields
lol
With non-static fields it is more fine, provided it is used correctly
I was merely giving an example, not what should be done ๐
i see way too many noobs here every day who can write a script, some code, but can't write a program because the tutorial they used neglected project structure and oop entirely
but this wouldn't work if it's not in the same class right?
correct
people who write a 300 line method body just fine
but then spend 2 days trying to figure out "how to get plugin"
what is oop
ah, the rise of the monolith
object oriented programming
isn't it order of operation?
wouldn't that be ooo
lol
OOOO
be we have two o's for oop
of is generally omitted or lowercased in acronyms
i'm about to go TOTALEN KRIEG on your ass
Anyways, you are allowed to use functional programming in Java and sometimes is ok to do, but generally should stick with OOP principles though
NNY.expand("TOTALEN KERIEG");
I always want to write a wrapper for bukkit that is written in a procedural style and just makes everything pass and give java/lang/Object
lol
life without generics
there's Naming convention, but is there a folder/project structure convention?
I think I could use interfaces when binding but use ASM to make everything use Objects under the hood.
src/main/resources, src/main/java are the two source folders
so i have all of my recipes in another class, but i cant access them. im using a config to enable them it is set to true, but i cannot craft anything, as I was before moving them to a class.. do i have to do something else to it, so it could activate?
You could use git commit --amend
if you haven't committed yet
Im using intellij GUI
or just git checkout HEAD~1 (not recommended)
then its a matter of telling git to forget the changes you made
and here we have the same "how 2 get plugin" issue but with a different flavor
I committed some files but forgot to select one
grrr
and when adding the recipe i did
getServer().addRecipe(hga);
but had to import
import static org.bukkit.Bukkit.getServer;
But i didnt before
can I un-commit?
Yeah, that is just git amend
No need to uncommit
then either use git commit --amend, or just re commit again to include that file
but like how does one do that XD
use amend if you want to preserve the same message and include it in the same commit ID
if it doesn't matter
just commit again
so two commits you mean?
yes
I usually do multiple gits myself so I can have different messages for different things instead of clobbering everything into a single commit ๐
also makes it easier when you want to undo something in a particular spot and not undo mass amounts of code too ๐
you know you have an amend button right there
yep
i meant to restart this machine yesterday
I don't use intelliJ so I wouldn't have known before hand ๐
Some here
about a month and a half ago I realized that the button highlight color in my os had reverted to blue from red
Imma go register for being legally blind now
since the theme editor can't change that value, I changed it through the registry
Well you get to join NNY @keen kelp because they are too ๐
and I'd need to restart for it to take effect
And honestly, I prefer CLI git as it is mostly granted to support commit signing
Yo NNY do you have a driver's license?
yes
that's a weird thing to ask
i don't even need to wear glasses according to my driver's license
kind of scary I must admit
I can drive basically anything that moves that isn't a main battle tank or a helicopter
I have to wear glasses or i would get a ticket
or a bus
frost said youre blind
i am
I literally see everything in 4
and am nearsighted as shit
yet I'm permitted to drive a hundred ton semitruck without glasses
I heard the little dots on the steering wheel is for blind drivers so they know what theyre pressing, is that true?
just so you aware, there is a difference between being blind and being legally blind ๐
bureaucracy at its finest
Near sighted gang rise up
so is he blind or legally blind
well, neither
i need to get my eyes lazered at some point to get rid of the 3 shadow images
but I haven't had the effort
He is color blind, as far as legally blind I don't know
My man can see the shadow realm
legally blind means it affects the person enough to impact the person to the point in which they need assistance in seeing right
he has only stated his color blindness XD
or smth like that
i'm not colorblind lol I just prefer red because it makes the shadow images less severe
idk how McDonald's laws work so yeah :/
i can still see other colors, unfortunately
unfortunately?
it means that even though they wear glasses their sight is still terrible and that there is no operation they can do to improve it. But this definition really varies on where you live. But in general just means even with corrective measures your eye sight is still terrible
Did you update ripcord NNYa
nah
Please
i didn't restart my machine either
just about everything has crashed and is pretty much tearing apart at the seams
but i just don't have the effort
how do you prefer to be called sir NNYaKNpGms0eUVpiSdHx
you may call me jolly christmas hitler
lol
It would literally take like 2 mins