#help-development
1 messages ¡ Page 2137 of 1
well i mean when im not using the entire screen to open noteblock
yah
just trying to use mysql
or sqlite
that will be easier
ye
yml isn't best choice for store large data
that will uses much performance when saving
im scared by all those asian pfps smh
<--
thats just black
racist
im sorry
that profile banner đ
no u
lmao
So there is an InventoryPickupItemEvent, is there also one that detects putting an item back down apart from InventoryClickEvent?
wdym? clicking on the inventory slot so the item is back in that slot?
I want to detect if the target slot already has an item of the same type
check the item of the clicked slot and see if its null or the type is air
InventoryDragEvent
otherwise compare it with the item on the cursor
ah the same type wait
Ok, thank u guys
when a player leaves, should i save the players inventory contents to file, or is the another way?
when a player leaves, minecraft saves its inventory contents to the player files?
when a player leaves the server, the server will automatically save the player's inventory, you don't need to do it manually, or do you have another thing to do with the player's inventory?
yes, but basically, the player spawns in the lobby, but i dont want some random items from a skywars game they just left to still be there, but for example, say there was a survival gamemode, i cant just clear the items, since everything would be gone in the survival gamemode aswell
you mean all your game modes are sharing the same server?
Seems like it does
Wdym?
you may consider use BungeeCord to separate your game into different sub servers
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
oh ok thanks
hello guys i have a problem with essentials, i trying to kick ban mute someone but everytime it say "/kick player [reason]" or "/ban player [reason]"
but i did everything right
i cant even ban or kick via console
/minecraft:ban
but i want to use essential command
ah
can u help me to fix it
did you provide a reasaon?
yes i type /kick player test
and it say same thing
for ban also
mute work
is player even a player name
i tried to kick me from console
yes i type my name
i use pex for ranks maybe i need to type also rank?
lets go to #help-server anyways
okay
Is there anyway to get an integer related to server tick? I'm trying to update the GUI every for example 5 ticks globally (All open GUIs must look the same) and the update is based on server tick
there are some forum posts about how to get the server tps
idk which one of them actualy works
if ur working with paper. iirc it has a TickEndEvent or somethn
hey , so there is a worldType called "CUSTOM".
WIth it, i can create a world with whats called a preset.
I can create a world with my plugin, set it tu custom type, but i cant seem to find where to put a preset.
ps : a preset looks like this {"coordinateScale":684.412,"heightScale":684.412,"lowerLimitScale":512.0,"upperLimitScale":512.0,"depthNoiseScaleX":200.0,"depthNoiseScaleZ":200.0,"depthNoiseScaleExponent":0.5,"mainNoiseScaleX":80.0,"mainNoiseScaleY":160.0,"mainNoiseScaleZ":80.0,"baseSize":8.5,"stretchY":12.0,"biomeDepthWeight":1.0,"biomeDepthOffset":0.0,"biomeScaleWeight":1.0,"biomeScaleOffset":0.0,"seaLevel":63,"useCaves":true,"useDungeons":true,"dungeonChance":8,"useStrongholds":true,"useVillages":true,"useMineShafts":true,"useTemples":true,"useMonuments":true,"useRavines":true,"useWaterLakes":true,"waterLakeChance":4,"useLavaLakes":true,"lavaLakeChance":80,"useLavaOceans":false,"fixedBiome":-1,"biomeSize":4,"riverSize":4,"dirtSize":33,"dirtCount":10,"dirtMinHeight":0,"dirtMaxHeight":256,"gravelSize":33,"gravelCount":8,"gravelMinHeight":0,"gravelMaxHeight":256,"graniteSize":33,"graniteCount":10,"graniteMinHeight":0,"graniteMaxHeight":80,"dioriteSize":33,"dioriteCount":10,"dioriteMinHeight":0,"dioriteMaxHeight":80,"andesiteSize":33,"andesiteCount":10,"andesiteMinHeight":0,"andesiteMaxHeight":80,"coalSize":17,"coalCount":20,"coalMinHeight":0,"coalMaxHeight":128,"ironSize":9,"ironCount":20,"ironMinHeight":0,"ironMaxHeight":64,"goldSize":9,"goldCount":2,"goldMinHeight":0,"goldMaxHeight":32,"redstoneSize":8,"redstoneCount":8,"redstoneMinHeight":0,"redstoneMaxHeight":16,"diamondSize":8,"diamondCount":1,"diamondMinHeight":0,"diamondMaxHeight":16,"lapisSize":7,"lapisCount":1,"lapisCenterHeight":16,"lapisSpread":16}
is it any way i can do /eco take (username) {amount} from a plugin?
bth it's exssential
Bukkit.getServer().dispatchCommand() works
yeah but how can i get the player i have a gui with all online plyers head and when i clikk on that i take money from them, how?
you should probably attach the UUID of the represented player to the head
i have the name not skine on head yet
how do you put the name on the head
is it possible to find the target players (@a, Player Name) of a command? I want to check if the command sender is in the same world as the targeted player.
public static void openMenu(Player player) {
ArrayList<Player> list = new ArrayList<Player>(player.getServer().getOnlinePlayers());
Inventory playergui = Bukkit.createInventory(player, 36, ChatColor.YELLOW + "Sandtak");
for (int i = 0; i < list.size(); i++) {
ItemStack playerHead = new ItemStack(Material.PLAYER_HEAD, 1);
ItemMeta meta = playerHead.getItemMeta();
meta.setDisplayName(list.get(i).getDisplayName());
ArrayList<String> lore = new ArrayList<>();
lore.add(ChatColor.GOLD + "Player Health: " + ChatColor.RED + list.get(i).getHealth());
lore.add(ChatColor.GOLD + "EXP: " + ChatColor.AQUA + list.get(i).getExp());
meta.setLore(lore);
playerHead.setItemMeta(meta);
playergui.addItem(playerHead);
}
cast the sender to a player if it is a player and then get the name @midnight glen
What if it is a command block?
and what event do I use to check every single command?
what?
I meant vanilla commands btw
oh you want to do that for literally every command being issued?
Yeah, I need to stop @a teleporting/giving items to players from other worlds
not sure if this would work but you could try cancelling the teleport event for the first one
I did that, now I need it for the other 30~ minecraft vanilla commands
lol
not sure if you can intercept commands, but maybe try finding something like that?
you might be able to cancel playerChatEvent
i know i was able to log all commands input by players that way, should work to just cancel the event
let me double check
but I need it mostly for command blocks
i believe this event fires when people type at all and hit enter
how woud that help?
is there a commandblockpacketevent or something like that
setting the owner profile could help you know which player it belongs to
Yes, use the Vault API.
i don't now how?
That being said not absolutely ANY plugin will use vault but it is a sure enough bet
https://github.com/MilkBowl/VaultAPI if you get some error, please do not create an issue without reading whether someone else experienced such an issue before
Unfortunately Vault doesnât have any documentation for youđ youâll need to skim other plugins source code to find out
Vault does have documentation though...
If you are unable to read a readme page you shouldn't be linking into vault
Blob this project might be too difficult for you, are you sure you want to attempt it?
public void CommandBlock(ServerCommandEvent e) {
if(e.getSender() instanceof BlockCommandSender) {
//do stuff
}
}
how do i check the targeted players / entities
meta.setOwnerProfile(player.getPlayerProfile()); this line is wrong
method names should start with a lowercase character
onCommandBlock now
on command block what?
I am trying to check if a command executed is from a command block and cancel the event for players in a world different from the command block
so I renamed CommandBlock to onCommandBlock because you told me to
1.18.2
wrong as in?
doesnt CommandExecutor#onCommand also works for command blocks? atleast i thought so
it does, but I need to do it for vanilla commands
like /tp and /give
also /scoreboard stuff
I need to make it so that commands executed in a certain world will only affect that certain world
Cannot resolve method 'setOwnerProfile' in 'SkullMeta'
Cannot resolve method 'getPlayerProfile' in 'Player'
Are you sure that you are binding with 1.18?
If so, show us your pom/build.gradle/whatever
Variable 'player' is already defined in the scope
lmao
anyone?
like?
why are we here
Inventory inventory = Bukkit.createInventory(null, InventoryType.FURNACE);
player.openInventory(inventory);
?
can anyone tells me why this code won't work
Are there any errors in your IDE
probably not supported
I mean if a command block executes /tp @a ~ ~ ~ then it will only teleport players in the same world
Oh so you mean all commands?
nope, it can actually open a furnace inventory, but the furnace just won't work
nope
Oh
Well there is no furnace at the backend, so there is no reason it would just magically work
I tired NMS, and I did some researches, most of people met the same problem as I did, and there seems no solution
yes that will not work
its tied to the block iirc and if the block doesnt exist... well
What exactly do you want to achieve? Just set a result or do something else?
How do I get the command block's / sender's world
It will not magically work - you need to set the output "manually" - i.e. smelting logic is done by you
That being said there is no API for actually setting smelting progress for some reason
Which is odd to say the least
is there in paper?
nope
To be fair, it usually does not make sense to set the progress on a per-inventory basis if it should be synced at a per-block basis
I tried use NMS to bond this menu to a block, but it still not working
^
just found this
It's Furnace though
ye ?
its gonna be null if you use it on a created inv
Because youâre merely opening a furnace inventory, you need to spawn a fake furnace using NMS for items to cook
then how do I get the targeted players
just wanted to make sure that there is no misconception
I did, and it not working
I mean, furnace inventory is one of those bound pretty actively to in world block entities
Use world.spawnParticle instead
I also can't get the world of the sender
I know
they are issued from a command block
but how do I get the affected players?
Command blocks might give you their block or location where you can get the world from
I donât think you can
Minecraft handles the selectors
You need to parse the entity selector yourself
https://wiki.vg/Protocol#Window_Property
this is the packet that would be required though i imagine
But you can use Server.selectEntities to easily get the selected entities
and how do I cancel the event for each player that isn't in the correct world?
e.setcancelled
but that will cancel it for everyone
yeah but I want to cancel it for just some players
basically I have a server where you load a personal world with an adventure map
and when the map executes a command it affects everyone on the server
You want to change the commandâs targeted players? You canât the command is implemented in another plugin
they don;t
what if it is vanilla?
You can cancel current command, modify the selector, redispatch the command
is there an e.setcommand
yeah there is
what is the difference between replace and replaceall?
Hi, one question i created a plugin sends messageswhe a player login
but in the console sends error
/paste
ok
@last temple
please help https://paste.md-5.net/cicomutaje.java
yes
exist
do you want to send you the config?
there is
ok thanks
and one question
can i have the config without the Conifg.
yes
ok thanks
its neccesari the Config:
ok thanks i will try it
?paste
@last temple like this? https://paste.md-5.net/buzihileno.cs
ok thanks i will try
oh yes
sorry
its Welcome.join.text
sure?
ok thanks
thanks you very much bro
yay
i did it
it was simply
@EventHandler
public void onPlayerCommand(ServerCommandEvent e) {
if(e.getCommand().contains("@a")) {
e.setCommand(e.getCommand().replace("@a","@a[distance=..99999999]"));
}
}
if anyone needs to do it
Hey guys
so im trying to make a punch bow
and everything works fine
but i made an event that it cancel the fall damage that caused by the arrow
i tried to see why but the code is fine(or thats what i think)
also i've got no errors in the console
ok for starters
the if else statement after checking if theyâre in the list in pointless
you just need an if
i mean it works fine
ya i was doing at first else
but i thought its maybe wont work
and then i changed it
so are you sure that theyâre in the list?
try making a print statement when the damage event checks if theyâre in the list
uhm
o okay wait
if (pBowArrayList.contains(p.getUniqueId())) {
p.sendMessage("bozo ur in the list");
if (e.getCause() == EntityDamageEvent.DamageCause.FALL) {
e.setCancelled(true);
}
it didnt send a msg
so the player isnt in the list???????
but how
@crisp steeple
probably because the player is not in the list
if I had to guess, it is because you create two instances of your pBowCMD class
how do you register the command and listener
getCommand("pbow").setExecutor(new pBowCMD(this));
getServer().getPluginManager().registerEvents(new pBowCMD(this), this);
ther
hmmm
[18:46] cqveman: mmmm
[18:46] cqveman: but
[18:46] cqveman: i didnt
[18:46] cqveman: how
2 instance lol
đ¤
wym
nvm
what is this
youâre making 2 instances of the class
You are creating two instance
o
each will have their own instance of the list
make one class for the command and the other for the listener
ik
or just
but i was just lazy
i mean yeah
alr
but having 2 different classes is better organization anyways
and then obviously cmd instead of the new PBowCMD(this)
ye
ya im doing this for all my plugins
when you register command and listener
i was just testing this for fun
an arraylist with one element is useless, use Collections.singleton instead
how does that list have a single element
wait brb
oh that
ye :p
cool kids just use Lists.of
Is it possible to have spigot and farbic on a server đ
Arrays.asList is also a thing
spigot and fabric are two different server implementations
im on java 17 and i've never actually used List.of đł
Okay, what about fabric alongside plugins
Well, mods for fabric
i dont recommend
using server softwares that broadcast having "spigot & insert mod software here compatibility"
I mainly wanna have Origins + Some other stuff
I've never seen a plugin not break when you use them
also not a question for #help-development
Its one specific plugin
Which I want to be added
but there is no mod for it
does anyone know this if you do please help me i have like a server thats wanting this and i can't solve this
did u register the event?
i did
wied
?
weird*
what is this?
yh im confused too
you know you can use e.getEntity().getKiller()
e.getKiller() is null
huh
yeah i did that but i got a massive ass error telling me its null so i went with a different apporach
did you try adding debug messages to every logic?
yes
uh no
create a test
try that it might help
mhm will help you find out the problem
should use pastes for errors/code instead of screenshots
/\
?paste
is the problem like when the player reaches 0 deaths it doesnt ban?
no the problem is that it does not register
like when the player dies nothing happens to the config does not change
no errors too?
if you're only doing player deaths why not listen to playerdeathevent
đ¤ true lol I didnt even see its entity death event
Dont use configs on runtime. When the player joins -> load all data, when the player quits -> save all data.
In the meantime you use properly named variables and classes.
this.reloadConfig();?
because when i listen to entity death event there is no killer and if there is e.getKiller() its always null
are you being killed by an entity?
player killed by a player
if its null then its prob fire or something that kills
that has to be the death type
but there is no way to set the death in a entity death event
Im seing that you use configs during a session. Dont do that at all.
Create a PlayerData class or something similar. Put it in a PlayerDataManager that contains a
Map<UUID, PlayerData>. Then on the AsyncPlayerPreLoginEvent -> load the data from a config into the manager
and on the PlayerQuitEvent -> remove the data from the manager and save it in a file again.
And at every other point in your code you use the PlayerData objects
the owner of the server wants it to have a config not just this for every plugin
it is still going to be config based tho
So? He will still have tons of config files.
just getting data as player data then manipulating then saving
few questions about this the HashMap is not gonna fit all the data
A Hashmap has a limit of aprox 2,1 billion entries.
you arent gonna store each value in it you are storing an object
Well... even more but then collisions become a problem
that was a stupid question lol
i phrased it incorrently
I never realised of the approach of saving player data as an object lol , all this time I used mysql cuz it was instant
mysql was instant đ¤
I mean not that delayed cuz it was running on localhost
and that DB must have been very small
yea
your saying i will store this information in the config when the player leaves i want it to be after a player dies by a player
Its alright. Your folder structure might look like this:
âââ_YourPluginFolder đ
âââconfig.yml đ
âââ_player-data đ
âââ1750cf0f-59be-4f11-9a02-2a39776ae311.yml đ
âââdd4e5a63-c2d3-479b-92d7-db77f6607c48.yml đ
âââda0edcd5-d4df-4bd1-9fa0-e89def6415d7.yml đ
âââ ...yml đ
You have a config.yml that contains all the configuration for the plugin.
Then you have a player-data folder that contains one file for each player.
If a player joins you simply load his file by using <his uuid>.yml
oh you mean custom configs?
create a custom yaml file and store the data within the manager in it?
The manager has nothing to do with any files. It simply holds a Map<UUID, DataClass> of all loaded (online) data.
but having lets say 60 yml files isn't it gonna be a bit messy
The alternative is a database. Its also not really messy. Pretty much the best solution you can have when persisting in flat files.
how could i get the first entry of an hashmap?
so create a class -> HashMap manager that stores data -> AsyncPlayerPreLoginEvent load the data to config
You cant. A HashMap has no internal ordering. The first entry could be a random value and the next time you look at it, its something different.
but i don't get this why are we loading the data from the config into the manager?
to access it in a simple way?
i get the element at index 0?
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
its a hashmap there is no element at index 0 theres a key at a value at a given index
sry read that wrong
ty
- Create
PlayerData.class - Create
PlayerDataManager.classthat contains aMap<UUID, PlayerData>. Create one single instance of it and only use this single instance ever. - on
AsyncPlayerPreLoginEvent-> load the data from<uuid>.ymland create an instance ofPlayerData
then put the PlayerData into the PlayerDataManager. - For all events -> get the PlayerData from the manager-
- on
PlayerQuitEvent-> remove the PlayerData from the manager and save it back into the<uuid>.yml
thank you, i was just wondering if it starts at 0 or at 1
hashmaps have no start and no end.
again, i asked for list
Ah i see
ty all
LUA: I pretend that I did not see that
Excel also starts counting with 1
lua
How do you embed a hypertext link in javadocs again? Do I really need to use an html anchor element?
psuedocode iirc also starts at 1
If someone called a programming language like that I will loose all my hopes in humanity.
is there a way to play the drink or eat animation with an item that is not really eatable, like a textured player head?
As far as I know not the arm movements themselves, but the effect can be replicated iirc
uhm
itâs client side
so not without a texture pack or mod
idfk how lamdas work, but will this convert my hashmap<uuid, killeffectsEnum> into hashmap<uuid, string>?
Map<UUID, String> prop = Maps.transformValues(getEffectsMap(), entry -> entry.getEffectCommandName().toUpperCase());
geteffectcommandname is my own method that returns the value's raw name
Maps.transformValues? why not just Stream#map?
seems like it turns it into a map with the uuid and the command name in uppercase ye
try it and find out ÂŻ_(ă)_/ÂŻ
didnt know (ClassName c) -> {} with the explicit classname was a thing
where should i look to learn lambdas do you recommend anything before i google it
What do you need this for? Because this looks like there is a better way of achieving what you are trying to do.
converting all the value types from the enum to the enum method that returns a string
ill try explain a bit better
i have a Hashmap<UUID, KillEffects> (killeffects is my enum class), and i want to convert that hashmap into Hashmap<UUID, String>, where string is a method in my enum. so its kinda copied over
Ok. What does the method look like?
it's tiny, it just returns my specified string for the enum value
public String getEffectCommandName() {
return effectCommandName;
}
WATER("&9Water", "water-326"),
uhhh
So the resulting map would be of type Map<UUID, Supplier<String>>
But why?
Map<UUID, KillEffect> map = ...;
Map<UUID, String> newMap = new HashMap<>();
for(Map.Entry<UUID, KillEfect> entry : map.entrySet())
newMap.put(entry.getKey(), entry.getValue().getEffectCommandName());
idk what's the problem with just writing code in regular java instead of doing dances to use lambda
because fancy
well yes i did that first but i thought it would be more clean to do it in a line or so.
and yes
fancy
i mean you could also just keep it as an enum and get the string whenever you need it
Ok. But still: Why would you ever want that if you already have a Map<UUID, Killeffect> ?
Why do you need to create all that overhead to create another map at all?
stream and collectors to map kek
Is it possible to set 2 scores with the same name in a scoreboard?
no, but you can add random color codes so it looks the same
Huh, that's smart
Thanks !
np
is there a way to set the skull texture to a custom png?
you'd need to upload the png to mineskin, then get the url and set it on a gameprofile
They also have a java library to interact with their rest api
is there a rate limit?
And with the 'new' PlayerProfile api from spigot you can create a ton of skins for your players to chose from.
I havent hit one so far. But its def higher if you create an account and generate a developer token
and do they expire? because the other method i have been using expires after 3 days
But if you lend them a mc account to generate new skins then its even higher. One acc can be used to generate about half a million skins.
oh my method has been accountless so far, but the skins expire after 3 days and they only work on heads
What does 'they' refer to?
half million per hour? or what time interval
the player heads
The signatures are valid for ~1.5 years iirc. So that timespan.
ah okay
the url for the head skin gets removed after 3 days
I havent seen a signature run out so far. But i give my generated skins a timestamp and create a new one after 6 months.
?paste
Please help https://paste.md-5.net/wecowoqiye.java
could you send your main?
yes
- Dont use 1.8. It freaking ancient and outdated/buggy as hell.
- Im suspecting that you forgot to add the command to your plugin.yml
But send us line main.java:51
^
i added the command on plugin.yml
name: Lex
version: '${project.version}'
main: welcome.lex.lex.main
api-version: 1.18
authors: [ zLexus16 ]
commands:
reload:
description: Reloads The Plugin
usage: /welcome reload
theres
Copy paste line 51 pls. And then show us your plugin.ym
ok
this is my plugin.yml
public void registerCommands(){
getCommand("welcome").setExecutor(new reload(this));
api-version 1.18 but you run a 1.8 server?
is on the line 51
yes

this doesnt make sense too, youre checking if its a player and if not, casting anyways
Anyways you forgot to add your welcome command in the plugin.yml
bruh
wait
yea it even returns when it is a player
so a player would never even reach the cast
dunno what that logic s supposed to do
how i can solve this?
by using !
i assume you tried to make it check if it wasnât a player, not if it is
why does he smel
what
leo
you really need to disguise yourself better
dumbass
?ban @trim surge ban bypass
Done. That felt good.
it was leo
who the heck is leo
a really annoying person
is that leoCAB !!!
yup
miss that guy around here
you should get banned with him
i hate that guy
hee alwaiz talc lik dis đ
shits annoying
that's pog
lol
i dont see the issue
ok i can let calling conclure daddy, slide
Conclure (ping for daddy)
but hes still annoying
idk i just dont like him
i hate reading encrypted text messages that are supposed to be english
mye cuz I talked to them after they got smashed by the hammer
not like I know what leo sounds like but ye
not much, I just delegated them to the mail support
wish you could control if the bans deleted the messages
I need help, how can I make Bukkit events create "HandlerList", so I can register my listener to the handler list
Why dont you just register your listener using the PluginManager?
because I actually need it to register to every event.
like every, like logging all the events that happen
because if the handler list is created when the class is loaded, I cannot like, register to the HandlerList and then I miss events that happen, and then I cannot do it.
The handler list is rebaked every time an event is registered
wdym??
Every single time someone registers any event, the whole handler list gets recalculated
recalculated? in what way tho?
why would it need to?
I guess I can go into the HandlerList class đ
seems stupid
oke, I found what you mean
Did that change? Let me take a look at the current SimplePluginManager impl
Ok so you just want to register a listener for every possible event?
What exactly are your plans?
I want to log every event
use a library like reflections and go from there ?
wdym?
I mean, there is no central place every known event is defined
use a library like reflections and go from there ?
ye, but which
Pretty sure that this will produce an unholy amount of data. How do you want to persist all of that?
it is literally called reflections
o_o
sorry for the confusion there
yes.
And how do you plan on persisting all of that data?
And then?
đ I mean, you are dealing with a shit load of new data entries every 50ms at best
block physics event might trigger a lot more often
you're kinda right
you might want to think of persisting that shit load of data first
before implementing it
The concurrency also needs to be handled in a smart way. Just creating a new thread on every event would be horrendous.
The only thing i could think of is to batch write it to disk every 10 seconds or so. With an NVMe this should be fine.
But i wouldnt sacrifice bandwidth by using an external DB for something like this. You server only has so much of it.
Yea you'd definitely have to do batch updates
but even then, you'll be buying a lot of storage lol
Well if you have a 2 way 1 gbit connection then you might be fine
I have 2TB.
Anyone know how I would be able to make the redstone custom colored?
player.getWorld().spawnParticle(Particle.REDSTONE, loc, 0, 0, 0, 0, 5);
but I'm unable to use it within that line of code it says
unless there is a specific spot
player.getWorld().spawnParticle(Particle.REDSTONE, loc, 0, 0, 0, 0, 5, Particle.DustOptions(Color.FUCHSIA));
shows that dustoptions is undefined for type particle
@vestal dome you do realize there's a method to subscribe to all events
Lets make a quick educated guess.
1 serialized String might be 30 chars long on average. Lets make it 32. So assuming we allow one byte per char this would be 32 bytes per entry.
With 50 players online i would at least assume an average of 750 playermove events per second. Then ~500 block physics events and
lets be generous and add 1k for the rest of the events per second to it.
Averaging 2250 events * 32 is 72MB of data every second. The write speed of modern HDDs ranges from 80-180 MB/s (for sequential writes)
Minecraft uses quite a bit of that already for chunk/world/player data.
So with a plain enterprise hard drive you would compromise your servers stability big time by simply logging the data.
Lets get to the capacity problem. A day has 24 * 60 * 60 = 86400 seconds.
Lets be fair and say that on average you only have to log half of 72MB/s (36MB/s).
This results in 2.7648 GB/d and around one TB/y
Might look acceptable but as soon as you get a bigger clientele this could shoot up to several Terabytes per year.
Yeah I just tried adding the second one and still gives off an error
Bukkit.getPluginManager().registerEvent(Event.class, new Listener() {}, EventPriority.NORMAL, ((listener, event) -> { serialize(event);}), plugin);
That would definitely explain it
reminds me
lmao ty
i truly hate people who are against getters
I dont know how they hate such an awesome concept
best part is theyre polymorphic
I can't tell
i donât think you can just listen to event
iâve heard it causes an exception
that method allows for it
well
i do hate kotlin for it
but thats not what im saying
ÂŻ_(ă)_/ÂŻ
im saying that people against the use of getters, and instead like public variables suck
kotlin has getters lol
Thats not the best part. A getter should be final.
I used it on a tutorial system for on-demand listener system type of thing
addEventObjective(PlayerEnterRegionEvent.class, (event, player) -> ...);
:o
its not in spigot btw
reminds me
turns out it was a cached world that failed to wipe
static aboose
Where
main
also you could reuse some getters y'know
mhm?
the constants are fine, but why can't you just pass an instance
I do it, we all do it, it's good practice
That isnt static abuse.
it sure is
you dont call anything you dislike static abuse
static meant for constants only, not for state
And split up some methods like not doing number conversions on a listener
also wtf is this command class
is having a static getter to a private variable static abuse
they shouldn't be static at all
idk how Forge's API works but there has to be a way to dependency inject
sorry for light theme, can't really bother re-setting up spigot dark theme
If you have a static getter you shoudl be usign the singleton instance instead
so a static getter without the singleton pattern, is static abuse?
yes
That's great info
unless its a constant
indeed, & also don't be so quick to reject our criticisms aha
Yeah, I was just confused ig
so the only way to pass objects around without singleton pattern
is with DI
well obviously it's not the only way, as you have seen, but it's the best way
well everything other than the configuration class
is a singleton
but its not enforced
a singleton implies that only one instance will be made
that only one instance can be made
if you don't control the implementation of the class you're using, you can't make it a proper singleton
singletons need to have a private constructor & a public method to get the global instance
how would i make a message saying "ending in 15 mins" then it goes down to 10, 5, 1, 45 secs, 30 secs, 10, 5, 3, 2, 1, would i have to make a lot of runTaskLaters
you could do it in one
how
just an array of times to fire the message
How do I split the config file into multiple ones, does the API support that
or do i need to write my own saving/loading mechanism for that
anyone fimilar with adding permissions / removing permission from a player
I'm to braindead to figure this out
GM4L
Yea I was going to but I couldn't find anything I just need to add and remove 1 permission
I'm ont hat website rn

thanks pal I connected my 2 braincells together thanks to you
glad I could help those two braincells đ
on what? đŽ
static getters without a singleton pattern are static abuse
others already told me they are tho
meh
nice profile picture Conclure
I mean static isnt really favored ofc, since its more procedural and object oriented
and usually comes with inherent tight coupling
but whats the scenario 2hex?
I only really use static for Util methods and Constants
you rly think?
red is a nice color
:3
i have a static getter for a few variables that are only initialized once
in my main class
mind link me?
more than that
oh yeah I don't do stuff that mind boggingly complex yet I'm really new still
fair
what is a stateless object
an object that once created does not change the values of its instance variables
instancers are kind of just a factory-lite
so what do u think
I mean its probably fine here
Like you're throwing away partial testability, abstraction and some reusability
but usually you tend to only change and want these properties for certain things regarding a minecraft mod
wdym throw away abstraction?
then it's not fine
static is extremely concrete and implementation detailed
thats kinda one point of static
or well
effect
Because its not inherited?
hm
tho that probably doesnt concern you here
It does, I don't wanna throw away benefits when there is another solution
ill stick with dependency injection i assume
How would I move the explosion in onentityexplode
Or do I just have to remove it and create new explosion
in theory, you could shift every block on the blocklist by your offset
alright 2hex, I mean you could just couple the config, and the other current objects you declare under the static variables into a context object
(like with a record or sth) and pass that
so have a data class to pass around with DI?
but all of them arent related to each other much
mye, well immutable data carrier which would facade your highest ordered modules
hey, sorry for interrupting, but how do i setup a redis pubsub without freezing the server?
async
yeah, if you can, solving it by distributing more classes would be way more robust
but if you just want to get away from static in particular
i have 0 idea how to do async with java, isnt the try {} catch {} stuff async because thats what im doing
wdym distributing more classes?
the biggest threat of using static here I could see is if initialization happens in multiple threads
CompletableFuture.runAsync
new Thread(() -> ...).start()
?di
From times to times, the usage of DI implies that classes have large constructors, which arguably decreases the maintability and readability of a class. Intermittently, this suggests that the class may be responsible for more than one major reason to change (formally known as the single responsibility principle), in which a conceivable solution would be to chop the class into smaller classes.
ty
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
is a sign of breakiing srp
unless it's a data class, or mostly data-based
Let me get straight to the point, having a static singleton that holds a bunch of other objects isnt much worse than passing a data/context object that holds the other objects
its almost equally coupled (not really, but from an oo view its deplorable)
do you mean both or one of those because i dont think i can use both lmao
either
ah kk ty
CompletableFuture is more advanced
leaked what exactly are you trying to do?
where you can link futures together and do stuff like
CompletableFuture.runAsync(() -> ...).thenRun(() -> ...);```
trying to get a redis pubsub to sync chat
what library do you use?
ah yeah threads look allot simpler lmao
Then just use a daemon thread
jedis
:c
bruh now its complaining about my chatevent reeee
Thread thread = new Thread(() -> jedis.subscribe(channel, this));
thread.setDaemon(true);
thread.start();
myeah just launch a thread like Illusion said
aight tyty
hopefully you use a jedis pool tho
oh no i dont i tried it and assumed thats why the server was locking up lmao
and return objects to the pool
ill go change that backk
@ivory sleet in conclusion, I should divide my classes more and use DI
So I don't break SRP or static abuse
yeah if you wanna be enterprisy, and properly object oriented exactly
i have 0 idea what returning it means
And to not sacrifice some benefits that static removes from me in this caae
you have a pool with 20 kids
you take a kid out of that pool and feed it a sandwich
are you just gonna let that kid stay outside and get sunburn
Like?
depends
but how would i return it?
theres the issue i was having with a jedispool!
"Kid" "it" wow.
I'd start with learning facade, adapter, proxy, delegation/forwarding, lazy initialization, observers... well all of them
Remember there's nothing new about design patterns, they're just formalized patterns that have been around for ages, we just gave them canonical forms and names such that we can think and talk in terms of them
[23:18:14 ERROR]: Error occurred while enabling JedisTest v1.0-SNAPSHOT (Is it up to date?)
java.lang.IllegalArgumentException: Unable to create EvictionPolicy instance of type org.apache.commons.pool2.impl.DefaultEvictionPolicy
wtf does that mean
google did nothing earlier
it tried to evict you but failed
you're likely lacking apache common pools
ah so my old landlord?
yep
fair play
Hmmm Alright, tysm
is that something i need to add to maven?
man tried to evict you through an apache helicopter and failed smh
yes
but yeah in short term keep the code base SOLID đ
pog
i mean the chat sync is absolute crap but its meant as an example
okki im uploading this to github to work on it tmr byeeee
Hi, how can I tell the Villager in code that he is forgetting his bed and work block. (Like when I take down the Villager's bed and block).
Thanks in advance!
You could probably use https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/entity/VillagerCareerChangeEvent.html
I dont see a way to get the bed though
declaration: package: org.bukkit.event.entity, class: VillagerCareerChangeEvent
do villagers actually have an assigned bed?
I didn't think so
I thought they always just head to the nearest bed
I dont think they have one, nothing in the code says they do ÂŻ_(ă)_/ÂŻ
oh
opk
ok*
and do they actually have any "assigned work block"? I also thought they simply get a profession and look for the nearest matching work block
I probably don't play this game often enough lol
they do match to that block and that gives them the profession
yeah but is that block now "reserved" to this specific villager?
if the block is broken & you havent traded with them to lock it in they will lose the profession
I think it has something to do with it but honestly I havent messed with it enough
or in CraftVillager
yeah
this is correct
the block would be reserved
hm weird, I don't see anything about the block in NMS villager
?paste
AAAH intellij light mode
VillagerData saves the VillagerType and VillagerProfession
but neither of those stores a location
you'll survive it
yes but why flashbang yourself?
Working with LP Api and having issues adding permissions I have 1 permission adding fine, but once it gets added all other permissions I'm trying to add are frozen. Using a basic util method All permissions increment I've tested all of them so the error has to be in my lpUtils class
Util Method
https://paste.md-5.net/hanepuhopi.cpp
LpUtils
https://paste.md-5.net/marohedafa.java
LIGHTMODE
send it alex
ITS FINE YA KNOWWWW I LIKE EYES
do it
suffer
perfect
OW WHY
on a side note clean your fucking keyboard
I have to support my local energy supplier
BRUH YOU JUST LOVE MILITARY GRADE FLASHBANG YOURSELF AT NIGHT
yes but e
I clean it everyday but it gets dusty again after a few hours because of the "pollens" outside or however they are called
there's this weird pollen-spawning tree right in front of my balcony lol
I have a keyboard I use in the machine shop where I work and it aint even that bad
me being a dumbass looking at how to make a permissions plugin
actually very simple
whenever I go to vacation, I simply put my keyboard into the bathtub lol
when I come back, it's dried again and I can again use it
lol
hey, is there a way to register a left mouse button click event? (no i dont mean damage, playerinteractentity event or stuff like that)
I mean simply the action of clicking ur left mouse button
no
simple until it comes to mongodb and stuff
what about workarounds?
no actually
ive never done mongo with java, ik theres spigot docs on it but still
oh is it?
you already mentioned the required workarounds
ye its pretty nice on JS
e.g. PlayerInteractEvent
mongo has a nice java api
I like mongo
all you really need to is make the actual db manager where you connect to it, otherwise just a method to get collections and thats about it, everything else is search methods and just uploading documents
wait do if im doing mongo do i want morphia or the regular mongodb one
I just run normal mongo
aight bet
I used Mongo Reactive Streams API
mongo is a german insult for "disabled people". I never understood why they used this word for the database thing lol
LMAO
lo
MONGO MONGO MONGO
hehe
people that use mongo are mongo /s
I wont lie my mongo methods are fucking huge
the docs say to apt-get install mongodb but why do that when đ docker đ
oh im gonna get fucking killed
why
for real, the word filter sucks...
idiot
ok thats not the blocked word
there
thats dumb
sooo my partner I work with wanted to have the rank color I use show up on /list but like, its coded in a way atm where it is the old chatcolor enum rather than hex
depp
and to change that id prob have to wipe the db
gg
is it also not allowed to say "diabetis" or "cancer" here?!
goosemod?
wow that code is cancer!
cancer
ikr?! I hate this fucking word filter
ah rip
unfortunately the staff ignored my forums post about this useless word filter
if i were to, say, make a rank system, would minecraft automatically handle the hex colors in chat or do i have to do that
so I can tell someone to go fuck themselves but I cant say mongo Loid?
I use MiniMessage through Paper
its nice
optic is resource staff, I don't think he has anything to do with it lol
oh I know
yes
THAT IS HOW YOU GAME MY GUY
if someone kills you
dont tell them to go fuck themselves
call them a mongo loid
ill go check that out
to be honest, "harmless" insults work way better than real ones anyway
I store stuff as strings and on the chat event (or actually papers) I just format the msg
I'll find my thing rq
e.g. you dense mcdonalds cardboard box lookin ass
noone cares whether someone on the internet calls you a "motherf**" but when someone calls you a "useless nitwit", then you start to think about your life choices lol
so accurate
yes i hink my life choices
i agree
believe its somewhere in the memory thingy
LP API can go die Idon't get it so therefore it is bad
like it stores a list of blocks or sth iirc
hm I haven't found it
oh i tried lp api ages ago it was absolute crap
and no not the villager data one
wat
the lp api is god ascend
flexible, robust and feature rich
I stopped looking at it, it's just sooo frustrating that Ctrl+Shift+F does NOT work in decompiled stuff đŚ
its like getting held up on assigning one permission 
or the "Find usages" thing
and wont assign others
hell yeah

