#help-development
1 messages · Page 77 of 1
When checking if a user is in a group, is it preferred to use the Vault API? I imagine that your code would support more permission plugins. But from the ones I've tested, just checking player.hasPermission("group.{GROUPNAME}") works with quite a few permission plugins. Do most permission plugins just write/check with the Bukkit API anyways? Is it guaranteed that all permission plugins use group. for the group permissions etc?
- it is not guaranteed that they all use group.groupname
- there is no proper permission plugin that I know that doesnt do it like that
- why do you need to check the group? cant you check for the actual permission directly?
GM has never supported group.
Gotcha. I'm checking to see if a player is in a group for chat formatting purposes (ie. prefixes)
- I wrote a permission plugin myself that does NOT use the group.groupname system but... it only has 14k downloads and only noobs that claim "WHY CHESTSORT ONLY WORK FOR OPs" use it, so you can just ignore this one anyway haha
I am probably safe to say that you can just check for the group.<groupname> perm without problems
The correct way to check a group is via vault or the plugins API. Groups mean nothing to Bukkit perms
true but many (tiny servers) use perm systems without vault and they also expect chat prefixes to work
I had figured most people used Vault, went to look into hooking it up and what not. But it looks quite outdated. Maybe I'm in the wrong place? Lots of perm plugins that aren't supported, etc
i'd do it like this:
- is vault installed? get the group / prefix from vault API
- if not - do the manual group.<whatever> check
Yeah, good idea. That's what I was thinking
well well well
vault is outdated but it also isnt
it's like schrödinger's permission system
it's oldschool but it works and it will also still work in minecraft 1.38
They stopped adding plugins to it long ago, but the plugins themselves add to it.
Ah right, so people are writing like vault extensions into their plugins?
yeah
vault is so easy to hook into, and it will never require updates until bukkit does really breaking changes
and as we can all see, this will never happen
spigot still supports legacy "0:1" stuff for andesite D:
Cool! Thanks guys, I'll get to work
do it like this and you're good to go for the next 5+ years :3
just use group manager ezpz
idk
@onyx fjord can i play fortnite on debian 11
wait this is #help-development not general
Hey guys, just while I'm around. What're your opinions on config files? I use configuration sections to section up the configs. But I feel like that's so much traversing and if I was to hold configuration sections in memory, it would just be wasted memory. Do you guys just leave config keys at top-level with some keys being second-level for stuff likes groups and what not? I just want to know best practice with config setups
You don't need to worry about the memory consumption of that
Especially because it's all loaded into memory anyways
So something like this wouldn't matter?
Cause if I access those nested sections via keys like "Global_Messages.Default_Format.Format", I feel like it's just messy. Like surely people do configs a bit different to what I'm doing
main config.ymls are already loaded into memory, and custom config files are held in memory when you call load() and stay in memory so as long as instance is maintained for it.
Yeah okay so there's no need to save config sections to variables, since accessing them from the config hashmap will be more efficient right?
as for the whole traversing part, you could re-structure or redesign your config file to be more easier for you. This is something that a programmer should be aware about and learn how to do because sometimes a redesign for the config is necessary or a different layout.
Sometimes it might just be more optimal or easier to use more then one config file
to separate out the information and make it easier either for you programming wise, or easy for the user
what is best is not something we can really determine, we might be able to help depending on the information we can see and you tell us, but even then still limited help because ultimately it really comes down to you in what you are ok with or what you determine to be optimal or just easier. We don't know your plugin or your vision etc in what you are trying to accomplish.
Yeah fair enough. That helps, thanks
this is how I have done caching
and this is how I do loading of the config file itself https://github.com/frostalf/ServerTutorial/blob/master/ServerTutorial/src/main/java/pw/hwk/tutorial/data/DataLoading.java
I do use in that plugin even though it isn't in a working state anymore more then one config file
there is a config file to edit settings for the plugin itself, and there is a config file that stores information about the tutorials that were setup, and then there is a config file that tracks users
The plugin is licensed under MIT so feel free to borrow code or use it as a template
Cool thanks, I appreciate that. Good to gather a bunch of projects for inspiration
and you also don't have to use yaml files either
you can find yourself a different configuration library for your plugin if you just ultimately don't like yaml
no one ever said yaml must be used, it is just what spigot shades in and thus a convenience most use since it is already provided
still stuck on this
so I read up on the implementation btw
in regard to this, and it turns out you really shouldn't have to exit the channels first
I think there might be something up in their API where they use default keyword and the stuff under that just not being ran when you use that close method
default stuff includes leaving channels
so might be worth possibly checking out on github if there is any reported/opened issues relating to your problem
if you can't find any, make one
include everything what you put above to include what you changed to get that one error to go away
How do i compile my .java file into a .class file?
I tried javac name.java in cmd
However it gave a bunch of unnecessary errors
how do i set the server resource pack through code
and enable forcing the server resource pack
is this possible
like through server.properties?
no clue 🤷♂️
probably
lol
You can probably ship it when the user joins
yes it is possible
declaration: package: org.bukkit.entity, interface: Player
so just use that function on join event?
but there's no function to act as if i had changed the setting in server.properties?
just double checking that
not that I am aware of
but I mean just keep the the url in a config so its changeable
and then use an event that is reliable where you can send it to them
what do I do if my code is shit but I got thousands of lines, just delete the project and start again?
that’s called refactoring
well
is that even
anyways, it depends on how shit
can you improve it without starting over
lets say it needs a miracle
itd just be nice to treat it as if i had the require resource pack value enabled
wait
gotta try something
time to find out if the require resource pack in server.properties still work if you do player#setResourcePack
Yes but that doesn't force it, they still got to agree to it. I believe you need to use packets if you want to force a player to use a texture pack
hello
HI
What should I do to understand and change stuff in this file or whatever they're called? https://github.com/lenis0012/LoginSecurity-2/blob/afae6616897455795acc8c08871abb64993ff02c/src/main/java/com/lenis0012/bukkit/loginsecurity/session/AuthMode.java
you want to fork the project?
for starters yeah of course
declaration: package: org.bukkit.entity, interface: Player
im a little familiarized with github though so that's not an issue
so first off you should read this https://docs.github.com/en/get-started/quickstart/contributing-to-projects
api has a method to force it
just have to look
yep
saves people wanting to tear out their organs with packets
not that packets are difficult anyways
I've never experimented with them
if you have any experience in networking you would know that packets are simple 😄
yes, assuming that spigots implementation of them isn't overcomplicated
I should try them at some point
NMS too, I've stayed away from that stuff for a long time
spigot uses netty
so just have to hook into that as that is what is used for the networking 🙂
even vanilla code uses netty too
Anyways, I completely recoded my API and it should be better now
DI everything
and some basic design patterns
well i was wrong actually
the error still shows up just takes a bit longer lmao
when trying to re-enable the plugin I'm also getting this error, which I assume is being caused by spigot:
Exception thrown when performing the maintenance task
java.lang.IllegalStateException: zip file closed
long version:
that error is for luckperms
you using the most updated version?
Any suggestions,
I am running SQL thru HikariCP and when I insert into the DB I get this.
`
[00:22:14] [Craft Scheduler Thread - 0/WARN]: java.sql.SQLTransientConnectionException: HikariPool-3 - Connection is not available, request timed out after 30000ms.
[00:22:14] [Craft Scheduler Thread - 0/WARN]: at com.zaxxer.hikari.pool.HikariPool.createTimeoutException(HikariPool.java:676)
[00:22:14] [Craft Scheduler Thread - 0/WARN]: at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:190)
[00:22:14] [Craft Scheduler Thread - 0/WARN]: at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:155)
[00:22:14] [Craft Scheduler Thread - 0/WARN]: at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:128)
[00:22:14] [Craft Scheduler Thread - 0/WARN]: at net.etherrealms.sql.SQLManager$1.run(SQLManager.java:73)
[00:22:14] [Craft Scheduler Thread - 0/WARN]: at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftTask.run(CraftTask.java:82)
[00:22:14] [Craft Scheduler Thread - 0/WARN]: at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:54)
[00:22:14] [Craft Scheduler Thread - 0/WARN]: at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[00:22:14] [Craft Scheduler Thread - 0/WARN]: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[00:22:14] [Craft Scheduler Thread - 0/WARN]: at java.base/java.lang.Thread.run(Thread.java:833)
[00:22:14] [Craft Scheduler Thread - 0/INFO]: An error occured: HikariPool-3 - Connection is not available, request timed out after 30000ms.
`
i think so
ill reinstall from the website
yeah i am
i wasnt getting this error before I had twitch4j on my plugin though
bump
sry just been stuck on this all day
how do I handle a java.lang.NoClassDefFoundError: on lower versions of minecraft
java.lang.NoClassDefFoundError: org/bukkit/block/data/BlockData```
java 8
By using an older version of the API?
No, I want to handle it
How do plugins deal with different api versions missing classes?
By using older versions of the API
They then create a bunch of different versions that load depending on what version the server is
Sorry if this seems very silly but how would I go about making a per player cooldown on specific items?
How do I find when a class was added to spigot, like BlockData
You sign my petition to get md_5 to approve my @since tags
why they not there already
what is the event that triggers when player leashes entity onto a fence?
ive found PlayerLeashEntityEvent but that is "called immediately prior to a creature being leashed by a player". like when they rclick the entity. not the fence. right?
any ideas?
Maybe interactevent
how would i determine that the player actually leashed something and not only right clicked the fence without anything leashed?
Ray casting to determine the fence that you can then use to check if a leash is their
If you find the version where BlockData was added then I'll sign it
The point is to find ALL the classes/methods and their versions not just BlockData
the leash can already be there and you just rclick the fence
or the leash can already be there and you bring new leash to it
where is the PR?
I'm not going to do it till I get an ok lol
well if I were you i would find some examples, and PR them stating that you will add all upon approval
Two questions. Repeating my earlier question how do I create cooldowns for specific items(not item types) that is per player? Also What would the best way to create a sort of dash ability for the player the ability would have to do damage to all entities that is would have passed(even if it is teleporting forward) and wouldn't take damage from having done so. Current thoughts for movement are velocity or teleporting but I also think theirs a better way that I just don't know about.
Well your first question is easy. Use a hashmap.
I need to listen to events from a class that is only instantiated certain times with certain data
Currently, I would have a separate class that can be instantiated no matter what and that stores a static list of the instantiated classes that need the event data, and then call the methods from those classes to pass on event details.
Is there any better way to do it?
anyone know that ticking noise that hypixel and stuff use? hypixel uses it for lobby countdowns
I'm reading this right now https://www.spigotmc.org/wiki/feature-command-cooldowns/ and when I made the CoolDownManager class it won't let me use the private final that is used their to call the first class. It doesnt say why just that its not allowed.
}
if (!inventory.getItem(12).getType().equals(Material.DIRT)) {
return;
}``` its saying getType() can be null but then it says ```(inventory.getItem(12).getType() == null)``` will always be false... so how am i supose to check
getItem can probably be null
long is a integer variable that stores as a integer not a string correct?
Yes
Then what does this mean?
I need to get the pic
Basically the error says that I can't use operator - on java.lang.string, long
which doesn't make sense.
I fixed it by removing the formatting that I was trying to use to format the outputs as a colored text...
what is NamespacedKey?
(Ping me with response). Would the way that this cooldown system is built work across multiple features in one plugin all referencing the same system?
https://www.spigotmc.org/wiki/feature-command-cooldowns/
why not
a key to reference a namedspace? what do you mean
im forking some plugin named hastepotions it had error about recipes and needed namespacedkey. but i dont really understand what to put in this
what to put in this?
hey, why does this return null even after holding an item
ItemStack item = playerInteractEvent.getItem();
Guys?
use inventoryClickEvent
read the code maybe?
see where its being used
So when I listen for interact event I want the player to give priority to chests or similar THEN, if the block has no right click action, I want my code to continue, how can I do that
ohhh alr
i was following a tutorial, soo it may have been outdated
wdym
always check the date that the tutorial was made/upated on
read the code and try to find where that key is used
then you will know what it does and know what to put in it
key wasnt used
i added it
A plugin is creating a recipe using a Deprecated method. This will cause you to receive warnings stating 'Tried to load unrecognized recipe: bukkit:<ID>'. Please ask the author to give their recipe a static key using NamespacedKey.
this was error
yo guys ive just cloned my repo with plugin, which one is to build that project?
its usually this
thanks
how do i get perms for offline player?
i was trying PermissibleBase pb = new PermissibleBase(Bukkit.getServer().getOfflinePlayer(suspected)); but it doesnt work properly
i need help
its with the IP forwarding
Where's the code?
player.hasPermission?
wdym?
I need help with Inventory Listeners
The tp thing isn't working for me
if (e.getView().getTitle().equalsIgnoreCase(ChatColor.GREEN + "Admin Gui: Teleport")){
if (e.getCurrentItem().getType().equals(Material.ENDER_PEARL)){
Player target = p.getServer().getPlayerExact(e.getClickedInventory().getItem(4).getItemMeta().getDisplayName());
Location targetloc = target.getLocation();
p.teleport(targetloc);
p.closeInventory();
}
if (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase(ChatColor.RED + "Bring")){
Player target = p.getServer().getPlayerExact(e.getInventory().getItem(4).getItemMeta().getDisplayName());
Location ploc = p.getLocation();
p.closeInventory();
target.teleport(ploc);
}
e.setCancelled(true);
}```
Whenever I try to use it I get these errors: https://hastebin.com/dupupejeja.properties
Heres the full class: https://hastebin.com/ruhedewedu.swift
OfflinePlayer doesnt have interface hasPermission
This channel is for developers
thanks
Can someone tell me how I could store a integer that's different for every entity? (not just the type of entity, but every entity)
Have you tried using PDCs?
What's that?
Persistent data containers essentially https://blog.jeff-media.com/persistent-data-container-the-better-alternative-to-nbt-tags/
?pdc
tiny example on how to store an integer inside a player / entity using PDC:
public class Test extends JavaPlugin implements Listener {
private final NamespacedKey brokenDirtKey = new NamespacedKey(this, "broken_dirt");
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onDirtBreak(BlockBreakEvent event) {
if(event.getBlock().getType() != Material.DIRT) {
return;
}
Player player = event.getPlayer();
int brokenDirt = player.getPersistentDataContainer().getOrDefault(brokenDirtKey, PersistentDataType.INTEGER, 0);
brokenDirt++;
player.sendMessage("You broke " + brokenDirt + " in total now, bruh!");
player.getPersistentDataContainer().set(brokenDirtKey, PersistentDataType.INTEGER, brokenDirt);
}
}
whut? can you try to rephrase this pls?
Ignore me, was my bad
ok lol
This wasn't really what I meant. What I meant was like balance or value or something like that
sooo?
it's just an example on how to store a number in the player
ofc you could do the same thing for balance etc
Firework fw = (Firework) victim.getWorld().spawnEntity(victim.getLocation(), EntityType.FIREWORK);
FireworkMeta fwm = fw.getFireworkMeta();
fwm.setPower(1);
fwm.addEffect(FireworkEffect.builder().withColor(Color.GREEN).flicker(true).build());
fwm.addEffect(FireworkEffect.builder().withColor(Color.BLUE).flicker(true).build());
fwm.addEffect(FireworkEffect.builder().withColor(Color.ORANGE).flicker(true).build());
fw.setFireworkMeta(fwm);
fw.detonate();
the firework spawns and detonates, but without any effect at all (its just the default little blob of white smoke and default sound)
I expect it to show the colored effects when it detonates
no errors anywhere
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
updated my message
lol that wasn't for you
bot commands in threads don't work so I wanted to copy the message
lol ok
I have been looking at docs and forum posts for like an hour
cant get it to work :<
your code looks good
just for fun, try to set it in the consumer
the consumer?
yeah wait, 1 sec pls
ah shit there's only one for dropping items
not for spawning them
ah nvm
I found it
1 sec
try sth like this:
victim.getWorld().spawn(victim.getLocation(), Firework.class, fw -> {
FireworkMeta fwm = fw.getFireworkMeta();
fwm.setPower(1);
fwm.addEffect(FireworkEffect.builder().withColor(Color.GREEN).flicker(true).build());
fwm.addEffect(FireworkEffect.builder().withColor(Color.BLUE).flicker(true).build());
fwm.addEffect(FireworkEffect.builder().withColor(Color.ORANGE).flicker(true).build());
fw.setFireworkMeta(fwm);
fw.detonate();
});
maybe you have to call detonate outside of the consumer
Firework fw2 = victim.getWorld().spawn(victim.getLocation(), Firework.class, fw -> {
FireworkMeta fwm = fw.getFireworkMeta();
fwm.setPower(1);
fwm.addEffect(FireworkEffect.builder().withColor(Color.GREEN).flicker(true).build());
fwm.addEffect(FireworkEffect.builder().withColor(Color.BLUE).flicker(true).build());
fwm.addEffect(FireworkEffect.builder().withColor(Color.ORANGE).flicker(true).build());
fw.setFireworkMeta(fwm);
});
fw2.detonate();
try this
great
the consumer basically lets you adjust the entity's settings BEFORE it gets spawned
this is nice because then in EntitySpawnEvent, it already has the proper settings
tbh I am very surprised that it worked lol
ngl its actually way more exciting when code works on the 100th try than it is when it works on the first try
Consumers get me hard, I mean...
eeeeh
they are great
yeah I especially like the scheduler consumers
🥵
e.g.
Bukkit.getScheduler().runTaskTimer(plugin, task -> task.cancel(), initialDelay, delay);
is there a gamerule for disabling pvp?
no
you can just do world.setPvp(boolean)
but no, its not a gamerule
"pvpMode" is a public field on the NMS Level class
bruh its grown so much lol
when you gotta test kill effects
me when I get killed by the warden
Do you guys know why my generic Z is showing the error:
Raw use of parameterized class 'MinigameManager' ?
public class MinigamePlayerManager<T, Z extends MinigameManager> {
Minigamemanager is generic
Oh right I forgot, can I just keep it that way? or how can i solve it
okay i just used ? seems to do the trick
Hey, how can I use Mojangs mapping instead of Spigots?
download it through buildtools and use
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>```
Alr thanks
How can I download it through buildtools?
I've already ran BuildTools before but I could only use Spigot mappings
java -jar BuildTools.jar --rev YOUR VERSION --remapped
Im not sure if spigot is the reason of my problems. but Im creating an adventure map on my mc server, 1.19.2 and my datapack(its only functions) suddenly stopped working and then 90% of theme stopped showing up ingame. can anyone help me with that?
so i have this to make a /lobby command:
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player p = (Player) sender;
p.chat("/server lobby");
}
return true;
}```
and it gets executed like a normal command, in the console it says that i executed `/server lobby` however for me it does nothing and says that this command doesnt exist (even though if i type `/server lobby` manually, it works)
any idea why?
that's because /server is a bungee command
and when you run it manually, it goes through the bungee server and never arrives on the spigot instance
so what do i have to do?
p.chat("/server lobby"); doesnt send a command iirc
it does
other commands that arent /server do work
yea but if i use bungee api i cant use spigot api
and bungee api is complicated and this plugin that im making is not only made for /lobby
its a server core
yes you can?
thats possible?
can send players to diff servers on a spigot plugin
might be wrong tho havent used bungee in a long while
so now when i try putting the bungee dependency i cant use 1.18.1-R0.1-SNAPSHOT
i can only use 1.19
just make a bungee plugin and add a bungee command with the name /lobby and then tell bungee to send the player to that server when the command is run...
its very simple
Does the ProxyServer.getInstance().getServerInfo("lobby").getPlayers() Method contains all players on the server or just the players connected through this proxy?
just to be sure ^^
you are taking info from the server named "lobby" so it will tell you how many people are connected to the "lobby" server
kinda obvious
*in a multi proxy network
pretty sure its the same
yes well imagine knowing how to create commands with the bungeecord api
and i also don't wanna learn another API for plugins
the bungee api is just like the spigot api
nah I tried it once and i barely could do like literally anything
but... but its super simple
Hey, why can't I use TinyProtocol with mojmaps 1.19?
is there a way to remove everything from the lore and make it so I can only see "Trail Effects" when I hover over the item?
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
thanks
Any ideas?
How do i load a new world? can i just replace world_nether with that world?
because TinyProtocol uses nms names
So what should I do to fix it?
either dont use tinyprotocol, or dont use moj mappings
Oh, okay.
How do I do that?
use both dependencies
?paste
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
Like this?
show code
which part?
ConfigMenu i'd assume
can we also see the config
it uses all the configs that have ever existed
its a config editor for all the plugins
so theres a config file somewhere that has a location in it
it just cant find a specified world
does anyone know how i get the playernames of the custom skulls on minecraft-heads.com
its not meant to do worlds shit, it just shows text
uh dont think you can unless you make your own loadConfig
loading the yml will always try to deserialize stuff
that's... NOT GOOD
they use base64 textures
not names
most of those dont have any name associated with them
now we're talkin
🥵 💦
use only remapped
TinyProtocol still doesn't work when I use spigot mappings
yes but to create these in a plugin you need a player as an owner
that has nothing to do with whether you use remapped or not, does it
What you using TinyProtocol for anyway
no you dont
you can just pass the texture encode
Oh, alright
my favourite effect out of all
Thanks
this is like the good version of protocollib
Does it work for 1.19?
sure
you sure?
Alright, thanks
it's 1.8 - latest
yes
new BukkitRunnable() {
double t = 0;
double r = radius;
public void run() {
t = t + Math.PI / 32;
double x = r * Math.cos(duration * (t-5)) * ((t-5) * .2);
double y = 0.5*t;
double z = r * Math.sin(duration * (t-5)) * ((t-5) * .2);
if(y >= maxHeight)
this.cancel();
Location pLoc = loc.clone().add(x, y, z);
pLoc.getWorld().spawnParticle(Particle.VILLAGER_HAPPY, pLoc, 1);
}
}.runTaskTimer(plugin, 0, 1);```
this is the maths just for a fucking spiral
just like imajin's mom
yeah remap doing this https://neomechanical.com/forums/how-to-remap-124
lmao they link to my blog
I'll take it
its my website lol
aah ok lol
I would have never thought that my blog gets popular
I'm literally #2 on google lol
built different
why is itunes so slow on windows
spotify all the way for me
apple hates anything that they dont make
still love them tho
still waiting for the M2 macbooks to be released....
I already put 4k€ on a separate account so I wont spend them before the new macbooks get released >.<
does java even support RISC
so how do I handle a destabilization error buoobuoo?
don't save un-deserializable data
you can make your own yaml loader
but that takes effort
🤷♂️
why is your data not deseriazable?
idfk
all and any config
oh just use SnakeYaml directly
you probably have ConfigurationSerializable objects in your conf right?
the ConfigurationSerializable class bullshit
but I could benefit from this, my plugin could be like an error detector
you could just remove all == keys from your yaml before loading it
nah yaml is great
it's only ConfigurationSeriazable that sucks ass, and not in the good way
someone should make a configuration override plugin that uses a db instead
so does it deserialize here? YamlConfiguration.loadConfiguration(file)?
could I just use a try catch?
ffffffffffffffffffff
you only need raw text right
alright snakey it is
yeah the only weird thing is that you gotta call like 4 init() methods lol
I still wonder why this is needed lol
Yeah, lol
I'm going to recreate snake in Minecraft using WASD
That's why I needed to listen to player input
sounds buggy
First, I'm going to experiment though
How can I give an enchantment over the vanilla limit e.g. prot 5? I just get a console error trying to do it
addUnsafeEnchantment
Ohhh ok thx
declaration: package: org.bukkit.inventory, class: ItemStack
weirdly, it's a method on ItemStack, not on ItemMeta
dont ask me why lol
💀
declaration: package: org.bukkit.inventory.meta, interface: ItemMeta
ItemMeta one takes a boolean
spigoot moment
oh yeah
weird how those methods are doubled
and one takes a boolean while the other one is a standalone method
lol
md_5 was probably just drUnk again
cant blame him
yep
i've spent half a year in australia in 2012 or so
it tastes like shit
i havent tried it tbh
its good to get rooted on
oh did you live here for a bit
yeah
idk I can drink it straight from the bottle, but the trick is
the bottle has to be warm
like room temp
not ice cold
if it's ice cold, I'd have to vomit
does it change the taste or smth
yeah
jägermeister always says "drink me ice cold" but no thanks
yeah like cough syrup
yeah it's shit
we have hundred different kinds of beer. the "usual" thing you'd get if you just order "one beer", it's a "Pilsener", it has like 5% alcohol
https://en.wikipedia.org/wiki/Pilsner this is what everyone in germany considers "normal beer"
ah yeah
this should do it right? java Yaml config = new Yaml(); try { InputStream targetStream = new FileInputStream(file); config = config.load(targetStream); } catch (FileNotFoundException e) { throw new RuntimeException(e); }
except for people from bavaria, cologne and dusseldorf
Is there a way to calculate how much spaces a letter is equal to?
as in pixels?
How much spaces i need for one letter to position it right
so.. pixels?
Depends on the clients font
Font Info Enumeration: http://pastebin.com/9Be2DF2z
Method to send: http://pastebin.com/BADd6K43
Many just recommend using a...
this dude made a good resource
for default font
Thank you
public class SpiralCosmeticsHandler implements Listener {
private final CosmicCosmetics plugin = CosmicCosmetics.getPlugin(CosmicCosmetics.class);
private void spiralLoop(Player player) {
new BukkitRunnable() {
final int radius = 1;
@Override
public void run() {
// Make particles in a spiral pattern
Location loc = player.getLocation();
double x = radius * Math.cos(loc.getY());
double z = radius * Math.sin(loc.getY());
player.getWorld().spawnParticle(Particle.VILLAGER_HAPPY, x, loc.getY(), z, 50, 1, 1, 1);
}
}.runTaskTimer(plugin, 1, 1);
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent e) {
spiralLoop(e.getPlayer());
}
}
this is supposed to show particles around the player in a spiral shape, instead absolutely nothing happens
might be a fault in the formula, I am very bad at maths
how can my plugin recieve a message from a player WITHOUT logging it in the console
without cancelling the message?
wat
How can i check if a player isn't wearing any helmet in a PlayerInteractEvent?
like so
player.getInventory().getHelmet() != null
oh you are talking about that kind of spiral
hello
nice spiral
it goes up and down
@misty ingot
@magic hornet we are already in a vc just talk there
why did u stop the ss
because I showed you everything in the plugin
so my formula is wrong yes?
?paste
byee
#general
average math users 🤓
public void run() {
t = t + Math.PI / 16;
double x = r * Math.cos(t);
double y = 0.5*t;
double z = r * Math.sin(t);
if(y >= maxHeight)
this.cancel();
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(Particles.HAPPY_VILLAGER, false,
((float)(loc.getX() + x)),
((float)(loc.getY() + y)),
((float)(loc.getZ() + z)),
0, 0, 0, 1, 0);
Util.sendPackets(packet);
}
}.runTaskTimer(Main.instance, 0, 1);```
How do I get a configuration section with YamlSnake?
I created a Map<String, Object> for my data
Yaml config = new Yaml();
Map<String, Object> data;
try {
InputStream targetStream = new FileInputStream(file);
data = config.load(targetStream);
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
}```
but like, even that aint showing up
oh idk then lmao
do I have to use packets or can I just show the particles normally
lets goo refactoring this https://paste.md-5.net/aquburutaz.java
whats t and maxHeight
imagine how big it would be without acf lol
t is the increment
as big as ...
maxHeight is, max height
🙏
max height for... what?
the spiral
t as in ticks yes?
so if I set t to 1 what would it do
i wanted to say somthing but ill shut my mouth
please do tell
something about step
please dont
anyways time to refactor that shit
also it would be VILLAGER_HAPPY not HAPPY_VILLAGER
this?
It gives me a error in the console https://pastebin.com/HXWKmdzWù
cursed cow lmao
link doesnt work
yes but with one line of particles instead of 2
and like, faster
and also without the cursed cow
...
private void spiralLoop(Player player) {
new BukkitRunnable() {
final int r = 1;
double t = 1;
final float maxHeight = 1.5F;
@Override
public void run() {
Location loc = player.getLocation();
t = t + Math.PI / 16;
double x = r * Math.cos(t);
double y = 0.5*t;
double z = r * Math.sin(t);
if(y >= maxHeight)
this.cancel();
loc.getWorld().spawnParticle(Particle.VILLAGER_HAPPY, ((float)(loc.getX() + x)), ((float)(loc.getY() + y)), ((float)(loc.getZ() + z)), 10, 0, 0, 0, 0);
}
}.runTaskTimer(plugin, 0, 1);
}
hows this?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
public void MaskEvent(PlayerInteractEvent event) {
Player p = event.getPlayer();
if (p.getInventory().getHelmet() != null) {
p.sendMessage("§cOdio i froci!");
} else {
if (event.getHand() == EquipmentSlot.HAND &&
p.getItemInHand().equals(Utils.getMask()) &&
event.getAction().toString() == "RIGHT_CLICK_AIR") {
p.getInventory().setHelmet(Utils.getMask());
p.getInventory().removeItem(Utils.getMask());
p.sendMessage("indossata!");
p.playSound(p.getLocation(), Sound.ITEM_ARMOR_EQUIP_LEATHER, 1.0F, 2.0F);
TabAPI.getInstance().getTeamManager().hideNametag(TabAPI.getInstance().getPlayer(p.getName()));
}
}
}```
ok so this thing worked, but the particles stopped as soon as it got to the max height which is supposed to happen yes but like, its supposed to come down aswell
bruh what devilish shit are you making
what is Utils.getMask()
there is no player
a brewing stand doesnt require a player to brew
Is the mask item
public static ItemStack getMask() {
ItemStack item = new ItemStack(Material.SULPHUR);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("§8§lMaschera Anonima");
meta.setLore(Collections.singletonList("§7Maschera Anonima"));
item.setItemMeta(meta);
NBTItem nbtItem = new NBTItem(item);
nbtItem.setString("mask", "mask");
nbtItem.applyNBT(item);
return item;
}
}```
just liek a furnace doesnt require a player to furn
use pdc
private final List<Location> getSpiralLocations(Location center, double yIncrement, int angleIncrement, radius, int totalPoints) {
List<Location> list = new LinkedList<>(); // using linkedlist because we're adding a lot
int angle = 0;
for(int index = 0; index < totalPoints; index++) {
angle += angleIncrement;
angle %= 360;
double angleRad = Math.toRadians(angle);
double xRel = Math.sin(angleRad) * radius;
double yRel = yIncrement * index;
double zRel = Math.cos(angleRad) * radius;
list.add(center.clone().add(xRel, yRel, zRel);
}
return list;
}
what is pdc?
?pdc
iterate through that list, get(frame) and render
presistant data container
you can get when the player puts an item in
the player doesnt "brew" the item though
it brews itself
getSpiralLocations(center, 0.1, 10, 5, 100) makes a list where particles go up by 0.1 blocks, 36 particles per circle, with a radius of 5 blocks outwards of the center
and the list size is 100 particle locations
ah
the player can brew things but thats not what minecraft is about
uhhhhhhhhhhhhhhhhhhhhhhh maths?
Some one know how to fix this error? https://pastebin.com/HXWKmdzW
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
public class SpiralRenderer extends Runnable {
private int frame;
private final List<Location> particleLocations;
public SpiralRenderer(List<Location> locations) {
this.particleLocations = locations;
}
@Override
public void run() {
Location targetLoc = particleLocations.get(frame++);
...
}
}
Gurwinder what is on line 441
Idk
I've seen this before
trap is a thread interrupt no? 🤔 🤔
has to do with setAmount and mutability
its trying to place a block thats not a block
what will the center be
or calling setAmount for an air item type deal
the origin location
You know how to fix it?
so like, player location?
for example
it's the center of the spiral
imagine a spring
it's the middle hollow area of the spring
ye
so basically the player location
cuz the spiral is around it
and so thats the center
yes
a spiral is nothing more than a circle
except each iteration increases the Y level a bit
Hi, so, uh
What causes this error? java.lang.IllegalStateException: Asynchronous entity add!
you are spawning an entity async
run it on the main thread
you better be kiddin me
who dat
your mom
origin isnt defined
same, thats why my code looks like this rn
I really really hate maths
I mean
if you want to render the entire spiral at once
you don't need the runnable class
if you want it to pop up slowly, you do need it
people instantiating bukkitrunnables get bonked by me
So yeah
just schedule that runnable
and you can cancel it when frame reaches the list size
but that would only do 1 spiral no?
cant i just put frame back to 0 when it reaches list size
you can yeah
I think I should just put all the math in one runnable cuz like the player position will keep updating when they move, so I will have to calculate the next particle position in real time
that's uhh fine
you'll still need a frame counter for the Y level stuff
Let's break it down by steps instead
your first step is to render a static helix frame
public void createHelix(Player player) {
Location loc = player.getLocation();
float radius = 0.9F;
for(double y = 0; y <= 2; y+=0.05) {
double x = radius * Math.cos(y);
double z = radius * Math.sin(y);
player.getWorld().spawnParticle(Particle.VILLAGER_HAPPY, (float) (loc.getX() + x), (float) (loc.getY() + y), (float) (loc.getZ() + z), 0, 0, 0, 0, 1);
}
}
this should do
half a helix is made
okay now
make an angle variable that increases along Y
but at a different rate
let's say, for every 0.05y, you add 2 degrees
convert it to radians and pass it for cos and sin
ok so I made a variable int angle = 0
and in the for loop I am increasing it by 2 at every iteration
yessir
I have lost around 300 since I started trying to make spirals
this is middle-high school math
angle in relation to pi
making a cosmetics plugin was a mistake
what doesnt school teach us anything we will keep remembering
BASICALLY
about math
a cricle is 6rad
same
i had 5 hours of math a week 💀
sin and cos allow you to obtain the x,y offsets for any given angle, assuming the circle radius is 1
this?
Yes
now in what way do I pass it to cos and sin
pass radian as the param
I failed trig but I still know cos and sin because particle effects
tbf i have used some shit i learnt in programming
i just not failed my math exams much times
?
I really have no idea what kind of maths this is I am super dumb
this has a visualizer for cos and sin
my average math % on my exam was 55% lol
this?
yessir
aight ima compile and test
in this case
sin is x
and cos is z
because Y is the vertical axis and minecraft yes
man inverted cos and sin
will have wonky results
,
you can make the angle more aggressive
I will
so instead of 2, you can pass for example 8
ima try 4
do a %= 360 to clamp it to 0-360
actually ima try 5
there we have it, almost done
shhh
forking is for plebs
real chads ask for help on discord
and die trying to recreate a feature
yes.
exactly
ayyyyyyyy
now to try 10
cuz its in the block
and mc doesnt like that
does that
smh
jinx
am i talking to some kind of animal now
yes
hmm probably a dream
more like a nightmare
D:
hm I wanna fix that one particle
break the block 💀
how do i make a bungeecord plugin in a command line without an IDE
you better be kiddin
ok now you just add an offset to your angle on every frame
use nano then
so like
int angle = frame * 2
for example
makes the first frame rotated by 2 degrees
second frame rotated by 4 degrees
i am not kidding!!!
maven can be used on cli and nano can so lets go
wdym?!!?
how 2 install maven for making proggect
something like this yes?
uhh idk
no
how can I cache my database data easily?
frame is PER scheduler tick
which adds an initial offset to your angle
that is increased per iteration on your for loop
scheduler stuff
also im new to java i've only programmed in C and some machine assembly so...
even better
public class WhateverSpiralRenderer extends Runnable {
private int frame;
private final UUID playerId;
public WhateverSpiralRenderer(Player player){
this.playerId = player.getUniqueId();
}
@Override
public void run() {
Player player = Bukkit.getPlayer(playerId);
if(player == null) {
// handle accordingly
return;
}
frame++;
int angle = frame * 2; // 2 deg offset per frame
}
}
how would i make tablist only show the players i want it to show for someone
coding on cli be like
Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, new WhateverSpiralRenderer(player), 1, 1);
write the compiled bytecode to save compilation clock cycles
instantiating a regular runnable here
:)
I know what I'm doing
nano is better than intellij
never understood bukkitrunnable honestly
fuck imports
I just have my own ScheduledTask class that stores the id and allows you to cancel it outside
#runTaskTimerAsynchronously is deprecated
call whatever
the only thing why to extend a bukkitrunnable would be to store it as a field and later on cancel it
cuz youre extending bukkitrunnable
extend runnable
smh
bukkitrunnable one is deprecated
I saw that
new ScheduleBuilder(plugin)
.every(1).ticks()
.run(() -> {
...
})
.async()
.start();
type deal
you call that porn?
god thats too nerdy
made it 2 years ago
matter of fact let me post it again so that they make sure its not porn
only uses like 15 classes to ensure you call it through that order
what about imillusion with his disk full of tentacle porn
I mean, still not appropriate at all for this ?
what's the problem with naming my disk according to its function
i mean he cant deny
@vagrant stratus BAN ME PLES
I can have multiple tasks running with the same scheduler with #runTaskTimer right
yes this must be a troll
yes
IM NOT RACIST MY DOG IS BLACK
I'll ruin it w/ a kick lmao
dumbass
Fuck that speedrun
or just ban o.O
I'd be surprised if they come back
I guess
actually havent seen anyone gettin muted here
yuk they are in paper too.
probably uses 1.8
ha
we can go back to talking about trig
bukkitrunnable
Kicked, since they're probably intentionally trying to be banned. I'm not giving them that satisfaction lmao
woe
Okay, what's next?
Runnable is just some random java shit and it throws error in IDE
how can i OP a player without actually OPing them, like not showing it in the list or anything
mother-
are you trying to make malware?
no
rest is correct yes?
i m making a plugin 1k op items
seems like it
amen
theres a 0.5% a player can find this item in a jungle temple (someone told me thats the rarest structure)
if they find this
no.. not its not
they have op for 15 seconds
frames :D
looks like a bush
make it run a lil slower
thats a good name ngl
sheesh
its still not what I wanted
flex your specs without flexing
wonky pig:
me with my 32gb ram so I can run minecraft in the background because I can't bother closing the game
someone should make a performance stabalizer for particles, shows the partciles without fucking performance
I have 24 gigs
with 8gb allocated to the jvm
I honestly think that my only underperforming part of my pc is maybe like
my mom didnt want to pay foor 32 gigs so i only got 16 💀
disk?
anyways this
just so I can have 2 windows of minecraft open so I can test with both my accounts on a local server cuz I dont have friends (and run a 4gb local server yeah that too)
can i prevent the OP message for all the players
except the other OPs
i dont want other players to know this player is OP
wont that inform all players this user is made an OP?
I first bought 16 then upgraded
i dont want players other than admins to know it
so yeah how should I fix this
he's coding fortnite in minecraft
try making the scheduler only run every 10 ticks
for example
you're making the helix run 20 times per second
mye i believe i can add another 16 too
ye
fps go brr
I overclocked my ram 💀
what the
got mismatched sticks and all
How to make a Collection with PotionEffect?
Or, return if frame mod something is not 0
overclocked from 3200mhz to 3600mhz
I have the angle increasing by 10 which means I have 36 iterations for each full loop of spiral so ima try with a delay of 36 ticks first
even more fucking things up like me
then adjust accordingly
didn't even know that existed for ram
like
I went through a lot of pain to make my rig
but I can at least say that I didn't ask mommy for money
well
I did ask but she said no
does setOP send a message globally that this player was OPied?
nice
it only informs admins/other ops?
does it send in the console atleast? or do i need to send that myself?