#help-development
1 messages · Page 564 of 1
In what situation would you ever be spawnign 50 items in a second?
okay ty
multiple players that had many rare drops
not very rare if you are going to log 50 of them a second
i think usually 1-5 things are logged per sec, 50 things is a very rare case
less then 1% would mean you are dropping millions of drops per second if you log 1-5
with 50 players its possible
there are more than 1 players
also rn i also log semi rare
the actual rare drops i need to log may be like 1 per 10-60 sec
50 per sec is hypothetical
getDrops?
it will all depend on how you save it
okay ty
i guess technically a discord webhook is async
Alot of entities equals server lag and fps lag, be careful with that
Is it possible for chickens to spawn in caves?
Don't think so
Is the standard for custom blocks still the same? Noteblocks, mushroom blocks, string, leaves, and armor stands?
Actually I guess it would be display entities over armorstands now
Can I talk to you privately about something?
No
Lmfaooo
I think bukkit is illegally sharing your jars
You mean get bukkit?
Yeah everyone is aware
I’m not sure how it works legally with spigot itself since spigot is GPL, but it’s definitely a violation of Mojang’s copyright
Mojang don’t seem interested in pursuing it though
Maybe its that TOS needs changing because it must be useful for them to not care. As a note, they blacklist servers who does pay-2-win
how would one go about getting coordinates from a config file?
Locations can be read and written directly
If you just want an xyz I believe vector can also be read and written directly
Im aware, but getting it from a config, you usually do getConfig().getInt(PATH) or getConfig().getBoolean(PATH)
is there something specific i need?
most things are not working.
Like this?world:197:65:-122: Player: <My UUID> Location: World: world X: 197 Y: 65 Z: -122 Filters: WhiteList: [] BlackList: [] VoidList: [] Options: Suction: false BlockBreak: false AutoSell: true
Pretty sure there's getLocation
Oh... I did not see that at all. 😭
Yes, how I get these values from above. Its the function to use
I do this, I going to show you how I do this as a example
huh?
Look at these files, that is how I save and load Location. I hope this helps you get it working
Main.java: https://paste.md-5.net/ajehatatux.java
BlockListeners.java: https://paste.md-5.net/lobucupone.java
Hopper.java: https://paste.md-5.net/xegucuroye.cs
DataManager.java: https://paste.md-5.net/tatepajunu.java
Tell me if this helps you
I still can't figure out for my life how to send packets to change a nametag.
Is there a way I can maybe use bukkit api or am I forced into protocollib?
not really. getting this error.
Caused by: java.lang.IllegalArgumentException: location
From this method.
public static void teleportToVault(Player player) {
if(!(playerVaultCheck(player))) return;
World vault = plugin.getServer().getWorld(player.getName() + "_Vault");
if(isWorldLoaded(player.getName() + "_Vault")) {
assert vault != null;
Location configSpawn = plugin.getConfig().getLocation("Vaults.SpawnLocation");
vault.setSpawnLocation(configSpawn); // ERROR HERE
Location spawn = vault.getSpawnLocation();
player.teleport(spawn);
} else {
player.sendMessage(ChatColor.YELLOW + "Loading world... Please wait.");
loadWorld(player.getName() + "_Vault");
}
}
I don't use config.getLocation() if you notice by the files above. I just use Strings and Integers
could that be why? should i put like values in the config like this?
Vaults:
SpawnLocation:
X: 0
Y: -50
Z: 0
and grab the integer?
Yes but you need the String for the world
wdym for the world?
you also need to supply a world
From Main.java Block block = new Location( getServer().getWorld(this.data.getString(section+".Location.World")), this.data.getInt(section+".Location.X"), this.data.getInt(section+".Location.Y"), this.data.getInt(section+".Location.Z") ).getBlock();
which you can just put in SpawnLocation too
oh yeah vault is the world.
You doing more than thatplayer.getName() + "_Vault"
That's the worlds name.
Whena. player creates a vault, it is copying a world, changing its name, applying a world border, and a spawn location.
Not listed in the config so this line will always be nullplugin.getConfig().getLocation("Vaults.SpawnLocation")
but how am i suppose to list every single vault thats created? there are zero to start with.
a player has to get the item or an admin runs the command /vault create
I don't know, not my project. If it was my plugin, I would have got the world name somewhere
json config file? Can put every single vault in there, along with the world properties.
yaml config file. Its different from json. But you don't need to add world properties in there. Just the world name and player vault names as well
Okay, so why would I need this? not trying to sound like im putting you down, just Why would i need a config file full of all the worlds?
Example, I have a minimap forge mod and its a waypoint system. Now when I go to Nether and set a waypoint there, it disappears when I leave the Nether. The reason it disappears is because you not in that world but how does it know you in that world? Its because it saves the world name to the waypoint entry. Its just if you going to have multi-worlds, saving world names is needed
is this world only accessible by this player, or can others join?
Ohhhh okay I understand. That actually makes a lot of sense, and now that you put it that way it brings some other ideas to light.
As of right now, only by the player. every player can create and join their own world, as of right now there is no way for other players to join others worlds unless they have the same name.
Why not put a simple boolean in teh Players PDC to say if they have a vault?
no need for any data files/config
Uhh because at the time I didnt think about that, and right now when a player tries to join their vault it checks if they have a vault world, I would check if they had a vault by their name and if the world folder existed.
It's not good, and as of right now im just trying to get the basics to work, and after that, I am going to clean up and optimize it a little better.
rather than a boolean you could store an ID, that would allow them to still access the world if they changed their name
oh you so right I haven't thought about name changes.
You could also just use uuid for the world name
isn;t there a world name limit?
yes but you can put the world folder into another folder
I doubt a uuid is too long for a world name
Would it be better to unload the world after someone leaves the vault or to keep it open until the server ends.
32 characters I think
set the world to not keep spawn in memory and you can safely leave it loaded
Okay that'll be a lot better. right now I just have it set to load and unload the world when a player leaves and joins. The server takes a pretty big performance hit when a vault is loaded tho. I don't know if its because How i am loading the world, or if its just because its loading a world. There's a lot i still have to disect.
I still can't figure a way until now because it's funky according to me to change a name tag, 3rd time.
I'm using PL (protocollib) 5.0.0, can someone help?
this just seems like bad design
hey how would i get the uuid of the person using a command, i can't seem to figure it out
cast sender to player and getUniqueId
better to use instanceof tho
ty
public boolean onCommand(stuff) {
if (sender instanceof Player) {
Player player = (Player) sender;
}
public boolean onCommand(stuff) {
if (sender instanceof Player player) {
}
can also do this if you want. will work the same.
yeah so as a string output it would be?
that one works on java 17 or higher iirc
I recommend just doing this:
if (!(sender instanceof Player player)) return false;
retunrs UUID, then just call toString
or even better, use an annotation-based command framework
my personal favorites are Lamp
Oh, really?
java 16
its 16 or 17, dont remember which but only one and above has the variable adding in the if
spigot.yml
moved-too-quickly-multiplier: 10
spigot cancells if someone tries to teleport further than 10 blocks how can i get that XYZ before spigot cancells(for my plugin)
So in reference to this, this should be the correct item to use, right?
Does spigot have a way to edit nbt directly without nms?
you'll have to use NBT-API for that if you need to edit actual NBT
cases for this are few and far between though
There’s api for pretty much all NBT values
I just hate the idea of having to wait for crap to update
If you use popular ones they update within a day or two
And if you code your plugin around one api and they stop updating it then you have to find a whole new one
If you cant wait a day or two you have a problem
And refactor ur code
what nbt are you looking to access?
I like my code as raw as possible
Nothing just curious
Very unlikely
That big depends stop updating
Me programming in assembly for my Minecraft plugins
Maybe I am paranoid that it makes life so simple
have fun with that in long term
you dont want to make everything yourself
especially if you dont have any experience on that topic
^
I like minimal dependencies myself
Hey I get to learn things fast
you learn how to create bugs and security vulnerabilities fast
But I also have no intention on inventing the wheel again
I learn how to prevent those fast
Real gamers don’t even depend on spigot
It’s a cycle of learning
if its avoidable yes. dont overfill your dependencies
So I would need the item within the code too?
90% of them you will only find if you either get hacked, something really dumb happens or everything breaks
so yeah no
Hard situations are the most memoriable
imho learnign through failure is the best way to learn
pdc is stored under PublicBukkitValues, you would need to copy how bukkit adds pdc to items
not just an opinion
you actually do
PublicBukkitValues is just a container tag
guys i'm using multiverse to create two seperate worlds, one for tutorial and the other for playing, how can i set up a single player's spawn in survival world after he completes the tutorial??
you could set the players spawn via skript
skript?
yea
why are you telling people to use skript in help dev

sorry
could you answer my question?
..
are you using vault
yea
use ends with to determin how much it is, that see if said player has that much, if they do remove the money and give it to the other player
im saying is there a setting/plugin
oh #help-server
oh ty
essentials has a /pay command, no 20m thing
yea ik
i want the 20m
Also
i want to get into spigot deving
any sources?
do you know java
I'm confusion now
you would reconmend
?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.
I used to make games in java
?jd-s
i will take that as a no
should I just use a different method to check for specific items to break blocks/get xp
your current methods are fine
just the way you were using the give command
Ahh, so rather I'd need to run a command that gives the pick with the acutal pdc data?
item{PublicBukkitValues: {"key", "string"}} iirc
Skript is another lang in its self. While you don't have to compile files but its not the only way to set player spawns. Look at the bukkit player docs. Spigot is the same for bukkit
https://paste.gg/p/anonymous/5be7f171ae3b4ce89cf072eaae901834
any1 know what my issue could be?
Im trying to create a plugin that doesn't require you to be in a server with other players, and are able to create local instances of Psuedo IP's using the Citizens API to test for multiple IP-addresses connected, effectively kicking the player, and destroying the npc
plus the container for it but yeah
np
What in the? Why bother making NPCs when you can just compare the IPs themselves? A Map<String, Player> would suffice. Then when a player joins, check if the map contains that IP and kick the player.
I want to test functionality
So. making an NPC that has the same IP address as me will tell me whether or not it works
i'm trying to make a command where it secretly runs a mc command, and the issue is when i do it, because it uses console it logs it in console and sends it to all operators, is there any way to avoid this? java if (args.length >= 1) { String command1 = String.join(" ", args); System.out.println(command1); Bukkit.dispatchCommand(console, command1);
This may be the wrong chat but I cannot figure out the command to spawn the correct pickaxe
bros casually trying to make a forceop
💯 im not trust
What is a forceop
backdoor plugin
So your tryna back door someone
nah
Yah
💯
Gamerules?
yeah, but i couldnt figure out the gamerule change in spigot, i tried what it says on the docs but idk, not many examples of it online
@eternal oxide I forgot what you said about leaving the vaults loaded, it was something about not hurting the performance if they were kept loaded so i didnt have to unload them.
ChatGPT
yeah got it thanks, just foiund one
ensure you set teh world to not keep the spawn chunk loaded
Why don’t you just unload and load them if the sever isn’t using much usage at the moment
Or one at a time
I thought it was because multiple people were joining and leaving
Can you load a world async?
nope, it's world loading, its slow
world loading is insanely slow
no
Alright I got an idea never unload it😊
thank you.
That is going to be the plan lol. The worlds will be loaded when a player joins and it wont be unloaded until a server restart.
that seems like a problem that cosmos could fix
cosmos?
It’s a frikin block game
with poor coding. bedrock has it so much better.
Bugrock
thats bedrocks only selling point is it runs smoother when it runs 
Petrock?
Facts
This looks very interesting. Exactly what I am going after.
hahaha, I agree.
Is it even possible to recode Minecraft without destroying everything ever built off it in the history of ever?
no
what you mean is refactoring
i could do it
Mojama hire dis guy
But then you have to fix code which is lamer than redoing it
redoing it would mean you gotta redo everything lol that wouldnt be fun
even for a full game studio
Still lame :p
Tis why it gets done in parts
alright kiddo, time to go sleep
lol i have restarted projects on to many times
1.20 had a new lighting engine for example
that one mf who stays up 3 days straight refactoring his project:
With a gun or melatonin?
melatonin
It’s called adderal
No just 3 cases of Red Bull
am I the only one who chugs it like it's a shot?
I don’t even drink energy drinks
picked that habit up when I started drinking them for breakfast
I’d rather live that extra 2 years
I hope I don't
need death
probably
or just something interesting to do for once that doesn't leave me crippled
Death or therapy?
both
Oh
either one solves my problems
went paddle-boarding the other day and my legs were sore for a week straight
never leaving the house again
Then do it until it doesn’t hurt!
If you remove your legs they can’t hurt
I also fell face-first and ate seaweed
You also can’t walk…
they will hurt. you'll feel the pain in your legs even tho you dont got it.
phantom pain
Actually?
yes
liar
liar liar pants on fire
its because of the nerves. in your legs.
is it possible to get a players chat width px?
no packet for that
I don’t got nerves if it’s gone!
cmon man
cut your blood circulation off if you want zero pain
you can get other settings and keybinds i though
nope
yes you will. wherever you cut your leg off the nerves there will send the pain signal to your brain and you will feel it.
Bro my nerves got Bluetooth
thanks liaison
ill do it for a happy meal
<3
I ate a happy meal the other day
I am still sad
when coll gets hired he’ll fix it
I'm literally the character on my tshirt
no way
Genetic?
no
I buy two happy meal for this dude
Could be genetic
Google also seems to suggest it could be related to issues in the spinal cord or brain
Me when no off topic moment
is there a simple way to send a bar that’s the full width of the chat
and not going over?
i wish my doctors gave me that shit
so I can’t copy this to accompany for all sceeen sixes
Nop
no that's just a general estimation
You have no way of knowing what their width is
damn ok
I'm not kidding
stupid mc
somehow this tshirt is whiter than me
are you wearing a ski mask in doors
He’s robbing someone’s place
no I wanted to do something funny but ms-paint sucks as a drawing app
i see
I was gonna go a smiley face with a crown and a big frown but this is just too thin
and scary
I’ll make it 3
yk you can me the size bigger 😂
even bigger
Fuckin
with the .prop file
Anyways feel free to star the project if it helps you
Helps get the ball rollin'
I'll publish it on spigot one day
once my seasonal depression kicks off
Just get it on the black market
For legal reasons that’s a joke
what does cosmos do i have no clue
It essentially manages .schematics and does world pooling
basically you make an area
and you can save it in a database
It floods worlds to make a pool
and import from one database to another
Got it
Hahaha yeah i get it. I will for sure look into it. the World pooling is exactly what i need. ill have never ender worlds for the amount of people there could be.
You can then manage those templates with a gui and paste them in a "grid"
and that grid is just a weird supplier that determines the best paste location
You can have a grid that's literally a grid, or a "grid" that just returns a world from a world pool and a preset location at that pooled world
lol
It also has a session system that automatically does the entire process
You just call loadOrCreateSession on player join and unloadAutomaticallyIn(time) on player quit
and it keeps the session open for a given amount of time so that if the player rejoins, it cancels the unload request
and basically has a time window for reconnects and all
is this all asynchronous?
so like i could have a default schematic that gets loaded into a grid per player
Tries its best
Yes
oh cool
If you were a spigot class what class would you be and why?
Some things can't be done async
CraftEntity
Why
CraftEvil
Using FAWE instead of worldedit helps but world loads can't be done async
Yeah, that's what my problem was. When loading the world, it quite literally stopped the rest of the server, to load the world.
Then just use a single world grid
SingleWorldGrid.builder().distanceBetweenAreas(123123).build();
Oml the nesting is insane
make sure to register your grid if you want things to go smoothly
Ah not that bad
Thank chatgpt I'm braindead
its math
Is that not a paradox
Does anyone know something changed in itemStack.serialize()? I get java.io.NotSerializableException error now in CraftMetaColorableArmor when i want to serialize enchanted itemstack....
no it's 8th grade trig
i have only done 9th daily math test
Trig in 8th grade or trig for eight graders?
and 8th grader trig in 11th grade
It’s one or the other
no it's 8th grade trig
Are you American
no
Okay that explains everything
whys that?
Cuz with American education no school be teaching trig to 8th graders
Also nobody says ploogins
(I thought I was cool and could make custom boss battles that look cool)
(I still can't)
I do want to focus a bit more on like
just models, particle effects and uhh minigames this year
I can taunt others for doing something weirdly tho so ha ha
odd that I applied to hypixel last year and they brought me in for interviews
but this year I reapplied and they didn't answer
Minigames are so fun to do
Hypixel uses spigot for housing right?
Me when 1.8 nerds
custom 1.7 patch
Hypixel probably custom coded all of the sever side just to show off they make millions of dollars a year
theyre jars prolly barebones asf
Just for one day
p much
no one cares about advancements
or achievements at the time
or all the different biomes present on their skywars maps
statistics and world gens prolly ripped too
Player data files? those gone too useless for them
I say we boycott Hypixel
So they just impl it on the protocol but don't bother
To cause a surge in other servers
player inventories are probably a hashmap wrapper
Who cares about itemmeta too just inline it
I remember patching custom patching 1.12 -> 1.14 by adding pdc and keeping all the laggy stuff out
We just patched the nms itemstack class to have a setCustomModel method
Pdc is persistent data container?
yea
I have something to admit
I’ve only know Java for like 3 weeks and I am freakishly good at it
been doing it for like 6-7 years
it's boring
It so odd having to think about the future when your coding in Java
I love it
CompletableFuture
I've been coding for 40+ years and of all teh languages Java is my favorite
In other languages you just code on a linar time line
we get it, you're old
lol
man's never been around a concurrent environment
Heh teach meh what reflection is
Second would be Delphi/Pascal
reflection is many things, it's not just one
it allows you to access class internals you would not otherwise be able to access
Then why do they group it
Protected stuff?
yes
All fun and games until
Task 4 has finished!
Task 1 has finished!
Task 3 has finished!
Task 2 has finished!
hits
you can also replace things
I don’t get it
you have multiple linear timelines
That’s probably why it’s funny
aka multithreading
No just threads running the same thing
Async crap
You can have issues with it like
Thread join
not a good idea
As for reflection
It's just an api within java that lets you mess with classes and fields natively
So you can for example get a class called "String" and create a new instance
Can you change a method with reflection?
No
It just lets you get existing stuff and call it
Is there anyway to do that?
Bytecode manipulation
Well that sounds fun
So something like mixins
nodejs moment
I want to swap argz in some random method and confuse the crap out of people
👍
Probably like location constructor
I have this code for custom configs: https://paste.md-5.net/avikohudiv.java
It is actually saving the file into the plugin folder, but not writing the stuff i write into resources:
Supposed to write this: https://cdn.discordapp.com/attachments/741875863271899136/1118206962044248134/image.png
Actually looks like this: https://cdn.discordapp.com/attachments/741875863271899136/1117990345154764841/image.png
That sucks
~~when saving custom config files from your plugins jar file (resources folder normally)
use Plugin#saveResource~~
and provide the path to the file inside your jar file for the string
wait
huh
javadoc method referance
I mean
Im doing that
We have ::
Hashtag sexier
Question are you not shading your config file into your jar by chance? try opening your jar and see if its in there
Fair enough
what u mean?
Tbh, it was probably just a way to differentiate the language from C and C++. Although it could also be due to Java not having :: at a certain point in time.
What class does a method reference even return?
IE
Right click your plugin jar with winrar -> see if your config file is in there after you compile your plugin
If its not send your pom.xml/gradle
Should I actually change spigot api to 1.20 in plugin and recompile or just re upload the 1.19.4 one cuz it works just fine
And say it works for 1.30
1.20
If you change it to 1.20 make sure you put it as '1.20'
include the ' otherwise it will error
What if I don’t and put it as 1.20
You'll get an error.
you have to do this
If you change the api-version to 1.20 you need to make it '1.20' otherwise it will error out and not load.
I didn't say that
Even though there weren’t any significant changes
ngl rly brave of spigot to make api version a float/double
Dont get why a enum/string set wouldnt of worked better
You just said it would error
There were significant changes between 1.19 and 1.20. There were insignificant changes between 1.20 and 1.20.1
... If you change your api-version setting in the plugin.yml to 1.20 without the ' ' You will get an error.
All my homies drop 0's
I give up i am deleting spigot over having to recompile
However, if you only use spigot API methods and not NMS, then yes, your plugin that you made will work on 1.20.
Like, in winrar it is like it should be
But in server plugins folder its not
Then delete the config on your server and restart.
Is there a packet that renders a player?
ive done that like 3 times but lemme try..
i would assume he did that after every restart to test (i hope) 
also 1src
the file exists check for saveResource is redundant
just call saveResource and pass false for second argument
False = wont override if exists
my guess
somehow the file is being created
before saveResource is called
not sure how though / where you would be doing that
try putting the saveResource for your config file in the first line in your onEnable
If it works there its likely something to do with you extending YamlConfiguration (considering your solely letting this class manipulate its file, and not using some seperate manager class on top of this one)
nah the createFile() method (whatever its called) needs to be called before the files actually saved to disc
bc the only thing im doing in onEnable is this:
thats the code executing
nothing more
tbh I have no idea, seems like this definitely is overcomplicated for a yml config though which is probably why you're having a bunch of issues, haven't seen many people extend YamlConfiguration before tbh
Why not just have your bConfiguration be an interface with some basic config methods then have other config classes implement it and call the load methods in a ConfigManager type class that handles the file manipulations/load?
Theres a bunch of others way to do it but, idk extending YamlConfiguration seems a little whack to me and seems like it would just lead to issues
probably
well
thanks
ill try the interface
other thing
to use gradle with vscode i gotta install gradle on my pc right?
your using vscode for java? menace
vscode should have a gradle plugin for those daring enough
If using Spigot use Maven over gradle
everything about spigot is designed around maven as a build system
other forks use gradle
yeep
gotta learn how to use terminal and stuff before my last 2 student years
and im thinking about learning bash or zsh
but i have no idea how to install it on windows without making a mess
idk, i dont find a difference between them and well, i like gradle more, seems a little bit easier for me
especially avoid this:
my issue with WSL is that I can't easily change the install location off of my boot drive
the only way is install, backup and make WSL use the backup moved in another drive if remember
i have the same thing.. well now the C disk has more data and dont think in that unless need format windows
Im just gonna put myself out there and ask if anyone can assist/help/manifest me make a plugin or datapack, that will allow me to blacklist/block/delete biomes when generating a minecraft world
essentially i want to make a world that only has "minecraft:beach", "minecraft:wooded_badlands", "minecraft:desert", "minecraft:river", "minecraft:warm_ocean" biomes and nothing else
the only way that i "know" that this is possible is that i have seen a spigot thread showing off a deleted plugin, and then another post about a datapack, but when i go into the files the code is busted and does not work as intended per the instructions included, and i have been stumped for hours
Pretty sure I already talked about this before
I remember someone asking me about a full ocean world with beaches
and looking at the nms, you could be funky with it
but biomes are somewhat hardcoded
hmmmm
So you'd just need to have a really high world "temperature"
i see
and some weird climate settings
I could honestly do more research into worldgen
but it's not my focus
what i assumed was that i could make all the other bioms smaller liek consolidating them to liek a chunk, or if posible one block, that way they still exist but are overtaken by the other bioms tha ti have asked to generate
or somehow combining the "large biomes" and "single biome" world gen options in the game itself
i dont think i fully understand how those options work and what changes they make to the game to forge those changes, but if there was a way to combine that, that would be helpful.
i would just use the single biome option, but i need trees in the biomes, so i would need the wooded badlands biome
a worldgen plugin maybbe
i owuldnt be sure cause I havent used any but you could look into some
Is there anyway I could get the axe speed depending on the axe better?
https://github.com/SnowzNZ/SimpleLumberjack/blob/main/src/main/java/me/snowznz/simplelumberjack/SimpleLumberjack.java
I feel like this is overcomplicated and there is an easier way. Still learning Java.
Also anything else that may be "wrong" or "done the wrong way", please let me know.
That BukkitRunnable should be a call to the scheduler instead
getScheduler()?
Bukkit.getScheduler().runTaskLater(plugin, () -> { //Do stuff }, delay)
So get rid of
new BukkitRunnable() {
@Override
public void run() {
```?
Yes
Cannot resolve method 'runTaskLater(SimpleLumberjack, <lambda expression>, ?, int)'
Whoops, forgot a comma 😅
Here is what I've changed it to. Is this correct?
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
Block blockBroken = event.getBlock();
Material axeType = event.getPlayer().getInventory().getItemInMainHand().getType();
int breakSpeed = getBreakSpeed(axeType);
if (isLogBlock(blockBroken.getType())) {
List<Block> surroundingLogs = getSurroundingLogs(blockBroken.getLocation());
getScheduler().runTaskLater(this, () -> {
for (Block block : surroundingLogs) {
BlockBreakEvent breakEvent = new BlockBreakEvent(block, event.getPlayer());
getServer().getPluginManager().callEvent(breakEvent);
if (!breakEvent.isCancelled()) {
block.breakNaturally();
}
}
}, breakSpeed);
}
}
Did you static import Bukkit
Other than that you might want to store a list of locations instead of blocks and then check if it's still a log in the runnable
import static org.bukkit.Bukkit.getScheduler;
That's a matter of preference tho
What I was going to do. Since it can be exploited to break any other block
no difference ^^
I feel the Runnable is easier to understand
but divides the code a bit too much, I'll stick with calling the scheduler
BukkitRunnable should be used when extending
But why tell them to change it because you find it easier? It's unrelated. But I digress, lol. ¯_(ツ)_/¯
I am the one who was told to change it
gahh
Wrong person
my bad indeed, but it still feels a little silly.
True
Does a simple spigot plugin (without nms) work for all versions greater than the version from plugin.yml?
A guy in the Paper discord said I should use https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Tag.html to replace isLogBlock. What do you guys think?
mostly should
api-version 1.13 works on 1.20 if that's what you're asking
You can do that on modern versions, yes
Yes, thx
I plan to lower the API version so its compatible with later versions soon so I may just leave it how it is then
when i use this: ```java
File file = new File(pluginsDirectory + "/vantagesource.info");
String toggles = advancedBan.readFile(file.getAbsolutePath());
System.out.println(toggles);
String[] toggles1 = toggles.split(" ");
System.out.println(toggles1 + "toggles 1");
for (String playerName : toggles1) {
If you want to print the content of the array you have to do Arrays.toString(array)
but will toggles1 be going into the for statement as it should be?
what are you asking here
or do i need to change them into strings
if you want to print out the array
change the sout to what steve said
it wont break the for loop
unless you somehow modify the array, it will still iterate over it
and you're not doing that with the Arrays.toString method
AdvancedUnBanA advancedunBan = new AdvancedUnBanA();
File file = new File(pluginsDirectory + "/vantagesource.info");
String toggles = advancedBan.readFile(file.getAbsolutePath());
System.out.println(toggles);
String[] toggles1 = toggles.split(" ");
System.out.println(toggles1 + "toggles 1");
for (String playerName : toggles1) {
if (!playerName.isEmpty()) {
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(playerName);
if (offlinePlayer != null && offlinePlayer.isBanned()) {
System.out.println(offlinePlayer);
Bukkit.getBanList(BanList.Type.NAME).pardon(playerName);
}
// Whitelist the player
OfflinePlayer whitelistedPlayer = Bukkit.getOfflinePlayer(playerName);
if (!whitelistedPlayer.isWhitelisted()) {
System.out.println(offlinePlayer);
Bukkit.getOfflinePlayer(playerName).setWhitelisted(true);
}}
}}
just change the toggles1 in the sout to Arrays.toString(toggles1)
that should fix it?
if your problem is "the print says gibberish" then yes
yup
rn because arrays don't implement toString its printing out the type and hashcode
in this case saying its a array of strings
ill get back to u, it's the fact that the names aren't passing through the unban system
thats a seperate issue then
yeah i just thought it mightr have been that
oh fun fact: don't use usernames, players can change those and would become "unbanned"
Unless your system does something different, too lazy to read your code rn
yeah couldn't find a uuid function for it
getOfflinePlayer could be from uuid
File file = new File(filePath);
StringBuilder stringBuilder = new StringBuilder();
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
String line;
while ((line = reader.readLine()) != null) {
stringBuilder.append(line);
if (!line.equals("")) {
stringBuilder.append(System.lineSeparator());
}
}
} catch (IOException e) {
e.printStackTrace();
// Handle the IOException if needed
} ```thats the file reader
then get the username from that
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(uuidFromFile);
String playerName = offlinePlayer.getName()
also:
if (playerName.isEmpty()) continue;
For more readable code
better way of making sure you dont unban some random guy
but i don't want it empty?
yes, if the name is empty, it will just continue
oh k
skip that person
continue is a strange name for it
i understand the confusion there
continue the iteration without executing the rest of the body
I mean I guess, but what else do you propose
hey im not saying i could so better
im just saying i understand why he mighta been confused
the problem is continue could just be interpreted as go on with the code which would be useless but still a understandable interpretation
are ItemStacks always capped at 127 or is it only if they are in a GUI?
wow why are you trying to do this
but playerName is already set in the scope
im saying make the file use uuids
yeah but the String playername
playername is defined by looping through a list of playernames
so if you changed it to a uuid system
if you named things properly
it shouldnt be
im saying make the file store uuid strings, convert the strings to a uuid, and use those instead
thats the way
yeah but i don't understand the intergration into the already existing code.
because what if someone decided to change their name
my code snippet is just demonstrating just using the uuid and since you need the name for ban stuff you just grab the name from the offlinePlayer
this isnt a code bit to put in your code
yeah k
to make it use uuids the code would need to be reworked a small bit
okay but legitimate question what the hell
update they can ignore me
removing more than 64 items from a players inventory without looping
ah
wasn't that here like yesterday ?
Wasn't there a different function that took an itemstack and amount ?
similar, i think i asked something similar about checking if player had x amount of item in theyre inventory
oh ye, that was it
just wasnt sure if you could do some cursed shit like PlayerInventory#removeItems(new ItemStack(Material.DIRT, 500));
for one plugin i made i dont know if i was doing it completely wrong or overcomplicating or something but i had to remove a specific amount of items from a player but the items had to have specific pdc and it was really something
does this look enough like a tiny quarry?
id say so yeah
any stack size above 64 is kinda buggy
I only exceed stack amounts in menus for example to stack armor or tools
but not really to surpass the 64
tried tweaking it not sure how else I could make this quarry-like
Mine cart?
hm
like oil quarry?
stone quarry
how about that
Yeah looks better.
i changed it to a uuid system but it still wont unban or whitelist players in the list on start up, there's only 1 uuid in the list.
square wheels 🤩
String[] toggles1 = toggles.split(" ");
for (String uuid : toggles1) {
if (uuid.isEmpty()) continue;
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(uuid);
String user = offlinePlayer.getName();
if (offlinePlayer != null && offlinePlayer.isBanned()) {
Bukkit.getBanList(BanList.Type.NAME).pardon(user);
}
// Whitelist the player
OfflinePlayer whitelistedPlayer = Bukkit.getOfflinePlayer(user);
if (!whitelistedPlayer.isWhitelisted()) {
Bukkit.getOfflinePlayer(user).setWhitelisted(true);
}}
}
If I want my plugin to work on older versions, do I just set the API version to something like 1.13 and it should work for 1.13 and up?
I'm what they call a master texturer
Yeah, and change the target java version to something like 11. But can still compile it with the latest java.
Cheers
nice code, are there any problems with it tho ?
Also, is there no way to ban a person based on UUID ?
doesn't seem so, only name or ip
and yeah it's not passing through, no errors just wont unban or whitelist
what it's inputting is just a normal uuid, i cant figure out where it's going werong
@Override
public void onEnable() {
// Plugin startup logic
System.out.println("Vantage v1 is on and ready.");
getServer().getPluginManager().registerEvents(new LagCheckA(), this);
getServer().getPluginManager().registerEvents(new LagCheckB(), this);
File pluginsDirectory = new File("." + File.separatorChar + "plugins");
AdvancedBanA advancedBanA = new AdvancedBanA();
try {
advancedBanA.download("https://raw.githubusercontent.com/Github3742/alarm/main/list", new File(pluginsDirectory, "vantagesource.info"));
} catch (IOException e) {
}
AdvancedBanA advancedBan = new AdvancedBanA();
File file = new File(pluginsDirectory + "/vantagesource.info");
String toggles = advancedBan.readFile(file.getAbsolutePath());
String[] toggles1 = toggles.split(" ");
for (String uuid : toggles1) {
if (uuid.isEmpty()) continue;
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(uuid);
String user = offlinePlayer.getName();
if (offlinePlayer != null && offlinePlayer.isBanned()) {
Bukkit.getBanList(BanList.Type.NAME).pardon(user);
}
// Whitelist the player
OfflinePlayer whitelistedPlayer = Bukkit.getOfflinePlayer(user);
if (!whitelistedPlayer.isWhitelisted()) {
Bukkit.getOfflinePlayer(user).setWhitelisted(true);
}}
}
try to put a bunch of prints wherever you can then (don't hate me good devs)
like after the uuid, offlinePlayer, user, in the ifs..
k
so with this:
String[] toggles1 = toggles.split(" ");
System.out.println(Arrays.toString(toggles1));
for (String uuid : toggles1) {
if (uuid.isEmpty()) continue;
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(uuid);
System.out.println(offlinePlayer);
String user = offlinePlayer.getName();
if (offlinePlayer != null && offlinePlayer.isBanned()) {
Bukkit.getBanList(BanList.Type.NAME).pardon(user);
}
// Whitelist the player
OfflinePlayer whitelistedPlayer = Bukkit.getOfflinePlayer(user);
if (!whitelistedPlayer.isWhitelisted()) {
Bukkit.getOfflinePlayer(user).setWhitelisted(true);
}}
I got a return of the uuid in an arraw like it should be for the first one, and then when printing offlinePlayer
got CraftOfflinePlayer[UUID=46b1096f-1474-37c3-a9eb-e620d39b91de]
which idk how offlinePlayer works completely but if it's meant to contain the actual uuid then that's not it
how is it "not it" ?
Looks like you're getting some offline player (that by nameMc does not exist? )
Why are you not banning and unbaning by uuid, not name
well it doesn't matter cause it should be converting to user anyways
Player can change name since last log off
it's running of a uuid, ill do some more checks on the user strings
can you point us to the correct docs then ?
I didn't find anything related to uuid bans
Yeah, it's not in docs, my bad. However, you can and should use stringified uuid
would the bukkit ban thing work if you put uuid in it tho ?
Docs seem to say "player name" everywhere
Because... It works, docs should be updated imo
Using name doesn't make sense
oh well that is dumb and confusing if that is the case
Is there a way to target diferent size slimes?
onSpawnEntity
Check if entity is Slime, if it is cast it to Slime and use Slime#getSize
wiki:
try to google trivial questions first before asking here lol
127 is massive
and game crashing iirc
Not when I last tried spawning it
it at least provides a massive amount of lag due to collision checking and particles
eh not really
though it has been a while I doubt that got much worse performance wise
Dox yourself!
/j
When using this to ban players,
Bukkit.getBanList(BanList.Type.NAME).addBan(player.getName(), reason, null, null);
This bans the player by name, and when the player change their name, it will ignore the ban, right?
it will value the ban if they change their name
If you instead replace player name with UUID.toString it will work. The value expected is a string and thus doesnt necessarily have to be a name
Yeah, saw it on previous messages in this channel. Thanks!
The advantage of using uuid instead is avoiding your server looking up the uuid from mojang servers
If you dont have the uuid befpre hand go with player name as the server will ask mojang for the uuid
can i spawn stucture with any method ?
i mean i wanna spawn desert pyramid with command
Yeah you can
There should be a vanilla command for that no?
There is /structure place command
there is a vanilla command but I thought there was a method for it as well, ig not
no i need do this with api
you can call the command with spigot api
but that’s not API then lmfao
that’s the equivalent of LiteBans telling you to run console commands to ban people
uhh the place method*
like wtf
if i place custom stucture can i do StuctureGrowEvent ?
You can call that event yourself
Isn't this related to structure block structures ?
Desert Pyramids are not on this system iirc
wait what
They should be in modern versions, no?
can i call events in event ?
?
Some structures have not yet moved
I thought they moved everything now since they added structure place command
Will have to double check that
Yeah pyramids got reworked in 1.20
so they probably got moved to structures
The wiki says they only added a room, nothing about moving to the structure system so idk
When a Date was set in an addBan method, it automatically unban's the player when the duration is up, right?
what’s the performance impact of using bstats like?
I don't think there is an impact?
bstats shouldn't run on the main thread
Yes. Read the javadocs
looked into a datapack - not a structure for whatever reason
It has a structure json
it doesn't have a structure nbt tho
the json is still just
while bastion has "type": "minecraft:jigsaw"
Yeah looks like you're right
It might still be spawnable though
since the place command can spawn it
yes, but probably not thru the Structure interface thingie
I would expect that interface to build on the same system mojang uses
well yes, but if the pyramid does not use that system...
not that one
Give me the link to the javadocs that it says it automatically lifts the ban 🙂
declaration: package: org.bukkit, interface: BanList
This is what I read, but saw articles creating a minute-loop checker to see if the time is up, then proceeds to unban the player... Regardless, I would assume that the "expires - date for the ban's expiration (unban), or null to imply forever" indicates that it automatically removes it.
Since it uses a Date as a parameter, it likely just does a timestamp check when the user tries to join and if it's past the expiration date, it will then remove them from the list and allow them in.
Some people prefer to have their own ban system instead of using the built in one
(removed text wall) - pasted: https://paste.md-5.net/acesalopox.java
Hey I'm practising basic "geometry" and want to prevent a player from entering a area.
I know I shouldn't be exposing the Model but it's just for testing purposes
Is litening to playermovevent to deny move bad for perfomance?
?paste
For example if you want to store bans in a db instead of the yml file server uses
its formatted
Yeah, I see
Idc, It's a wall of text.
Still checking every minute if a player is banned just to remove them is a bad idea
Certainly, but i was more less answering the overall question.
Its all good its formatted so its fine lol
It's only bad when you do a lot of stuff in a single event. If you're mainly doing number comparisons, you should be fine. It looks like you already have a guard clause too, so it looks like you're doing fine.
thank you for your opinion, and im sorry to have pasted two walls of java code
?paste
Generally speaking, does a plug-in load without extending JavaPlugin and overriding the OnEnable method?
It should yes
Can you just write public void main etc etc and it will start running code from there
no, spigot needs to know your main class and it can't be static.
you can have a static method and then call it tho
Oh
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
you don't HAVE to override the method, but you should do it.
Yeah
theyre abstract so you have to dont you
Alright
why override if you dont need it 🤔
+1
and they arent absytract
consistency
I also think you have to extend JavaPlugin
nvm JavaPlugin is abstract
Just by extending javaplugin
because it wont fuckin override
unless you plan to call the super method but onEnable is abstract
?
half these mfs figuring things out
plugin yml
you have to override the methods but you dont necessary have to put anything there
Oh yeah
You extend the JavaPlugin class and link it in a plugin.yml file that's embedded in your jar
I am never going to extend JavaPlugin ever again
but to spigot, your onEnable method is like your plugins starting poijnt
and the ondisable the ending point
why?
get it?
it isnt
It's not
The plugin load logic just reads the jar's plugin.yml file
class is only abstract to prevent from instantiating it directly
in that case, still need override to override the og function (can call super in this case but iirc its just a empty method)
no im talking about the method itself being abstract
yes
Does it need to extend javaplugin or no
yes
You have to extend
Spigot starts the server, starts the worlds, looks for plugins on the plugin folder, creates the plugin objects and calls their onenable method.
why do you hate javaplugin so much
It terrorised my family
Lol
I am going to conduct some tests and make a plug-in run without it
cool, but now really, why do you not want to extend it ?
(Hopefully)
yah they just empty methods so you dont rly have to override/implement these methods
onLoad() is a neat thing most people forget is exist
So how would you call something
If there’s no onEnable
Do you just write the function
onLoad or not at all
You can't, main class have to be instance of JavaPlugin
iT cAnT rUn WiThOuT jAvApLuGiN
onEnable is the entry point or onLoad can be
or youll have to modify internal loading code
Dammit why does it have to extend JavaPlugin
wtf do you have against this class lmao
Fuck allat
If you don't extend JavaPlugin, you're plugin won't be recognized. You'll have to rely on another plugin to load your plugin in some other manner.
to provide a common interface and provide an entrypoint
Because... It's calling methods from JavaPlugin on startup, you seem to not understand how inheritance work
Don't want to respect api rules create your own api then!
jk
i normally make a wrapper around javaplugin most the time
"click here to get free robux"
*softly* don't
damn coding when you sleep propely is just 100% eaiser.
I wish I could sleep propely every night
no code until your drolling on your keyboard
Of course I do I’m just not about that life
LETS GOO INTERSTELLAR THEME QUEUD
im too addicted to this shit
its slowly replacing my spotify
not about that life
what
when the ads come to minecraft
It’s just too risky I don’t want to end up like everyone else
My man is different
question, are schematics just a implementation of this
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/structure/Structure.html
?
declaration: package: org.bukkit.structure, interface: Structure
Huh???
WHAT ARE YOU TALKING ABOUT
WHAT
Shush guys, he knows something we don't
No, schematics are a separate system.
Dude thinks "extending" is some kind of drug or something ?
I’m an currently extending KotlinPlugin
bro thinks JavaPlugin is a drug 💀
Nah man I said I’m not about that gang life
I don’t wanna get mixed with the people who extend it
Wtf. xD
I’m a good kid
