#help-development
1 messages Β· Page 231 of 1
no, I want to debug the code of the server
Take a look at this sample project: https://github.com/PaperMC/paperweight-test-plugin
take a look at this
https://www.spigotmc.org/wiki/intellij-debug-your-plugin/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
why does HeapCharBuffer has to be an internal class grr
Found this like 2 weeks ago and its life changing
can i do .equals("player1", "player2")) ??
This works too if you want to use Spigot instead of Paper
might wanna google how to compare string in java
I'm trying to modify the spigot Jar, can that do it? I need to see it on a IDE to debug and test
and tip number one: dont do spigot when you dont know java
Modify?
So you want to make your own patches instead of using the api
basically making your own fork
If it's just for debugging use the links above so you have access to breakpoints
yeah, kind of, I would like to directly edit it tho, im not sure how are the patches made tho
Directly editing is not worth it for debugging and testing. Use breakpoints
If you really want to modify the code follow: https://www.spigotmc.org/wiki/guide-contributing-to-spigot/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Thank I think this is what I was looking for
Does someone know how to fix this?
https://i.imgur.com/yq8y1S1.png
Wrong import
It happens with almost any nms
Hi! How can I block sideways moving of a player who riding a horse?
Could you? Probably. Do you want to? Probably not?
How to do that?
This is my current code
public static void restoreInventory(Player p) throws IOException {
File f = new File(WargroundsMain.getInstance().getDataFolder().getAbsolutePath(), p.getName() + ".yml");
FileConfiguration c = YamlConfiguration.loadConfiguration(f);
ItemStack[] content = ((List<ItemStack>) c.get("inventory.armor")).toArray(new ItemStack[0]);
p.getInventory().setArmorContents(content);
content = ((List<ItemStack>) c.get("inventory.content")).toArray(new ItemStack[0]);
p.getInventory().setContents(content);
}```
I wan to..
Use the bukkit import for that one
When I say that what I mean is something along the lines of "it's not going to be easy and it'll probably be very buggy"
thx bro, idk why nms is so buggy for me
Why do phantoms not extend Monster
because they are imaginary
they are hallucinations that haunt u when you don't sleep
I love it when my hallucinations swoop down from the sky and smack me to death
don't we all
I mean Monster is just an interface that represents monsters as in despawning in peaceful mode, spawning during nights (iirc certain sounds [like swimming] also thats common for all monsters) etc, but both Monster and Phantom nms wise do implement Enemy
huh, alright
Is there an elegant way to check if a Mob is hostile?
without using nms
no
actully maybe but i'm stupid
I might just make my own utility method that checks it against a list of hostile EntityTypes that ill make
hm, true
But that would return true of things like parrots as well though, no?
Since id assume those are also instances of Flying
Ah, I see my misunderstanding
are players flying
I had assumed that anything that could fly on its own would be an Flying
But this makes sense
yeah, that appears to be the case
What is the ItemStack for Villager Egg?
then use spawnegg meta or smth ig
I have a plugin that, when a player gets hit or attacks, adds their uuid to a hashmap. After 10 seconds, it removes this from the hashmap. The problem is if you attack once then wait 9 seconds and attack again, you are only on that hashmap for 1 second. Does anyone know of a way I can fix this? I have this error in similar instances a lot.
put it again regardless if they're on it or not
yes but lets say they attack at 9 secs and it adds them to the hashmap, then one seconds later, it removes them
what is that?
use millisecionds?
oh yes
that would work
ok, what do I use to get the current millis?
oh I see
why do ppl use # instead of .
ok
okay
Kind of a dumb question but PDC isn't thread safe right?
Nothing in Bukkit can be assumed to be threadsafe
cant really find the deepest impl but ig its backed by some kind of collection that is not threadsafe
ig thats why i couldnt access the deeper classes
Yeah looks like just a HashMap
I'm looking at Chunk PDC
private final Map<String, Tag> customDataTags = new HashMap<>();
private final CraftPersistentDataTypeRegistry registry;
private final CraftPersistentDataAdapterContext adapterContext;
public CraftPersistentDataContainer(Map<String, Tag> customTags, CraftPersistentDataTypeRegistry registry) {
this(registry);
this.customDataTags.putAll(customTags);
}
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Igniore me please, just looking for the url
is there a way for me to change the gradle build location? Like where it puts the built jar file?
I tried okay
x3
Solution:
jar {
destinationDirectory.set(file("$buildDir/someDir"))
}
probally a stupid question, but i compiled my plugin, put it in the folder, and it is not in plugin list?
I am trying to code a mini games and when I tested it this happened.
Error:
Error occurred while enabling MineClashMiniGames v1.0-SNAPSHOT (Is it up to date?)
java.lang.NullPointerException: null
at java.util.Objects.requireNonNull(Objects.java:208) ~[?:?]
at mineclash.minigames.MiniGames.onEnable(MiniGames.java:19) ~[MiniGames-1.0-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:542) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:565) ~[paper-1.19.2.jar:git-Paper-223]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:479) ~[paper-1.19.2.jar:git-Paper-223]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:636) ~[paper-1.19.2.jar:git-Paper-223]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:422) ~[paper-1.19.2.jar:git-Paper-223]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:306) ~[paper-1.19.2.jar:git-Paper-223]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1100) ~[paper-1.19.2.jar:git-Paper-223]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:305) ~[paper-1.19.2.jar:git-Paper-223]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
look at errors in the console
what is MiniGames.java line 19
Its not under the read / unloaded section ill check though
It may be near the top
I see it, but it is saying
nvm i see the problem
something is null in line 19
for some reason this just makes it day-night-day-night without actually stopping when it should reach the break;
also it doesn't kick me out of bed when it becomes day
what are you trying to do?
Basically nicely skipping time forward to day when only half the servers players are sleeping
maybe it's because curSleeping.size() doesnt change
curSleeping.size() = current amount of players in bed
you're doing it in a while loop which does it all in 1 tick
new BukkitRunnable() {
you can define variables here like;
String name = "minion325";
@Override
public void run() {
The run is like the inside of your while loop. So you can do an if (condition here);
cancel(); breaks the loop
}
}.runTaskTimer(plugin, 0L /*<-- the initial delay (0 ticks)*/, 1L /*<-- the interval (1 tick)*/);
^^
Thank you very much ^^
Im making a plugin for homes and other stuff like that, how would I override essentials messages
you mean commands?
how do you write thread safe code
[18:10:58] [Server thread/ERROR]: Error occurred while enabling CraftyCore v${version} (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "org.craftystudios.CraftyCore.getCommand(String)" is null
at org.craftystudios.CraftyCore.onEnable(CraftyCore.java:77) ~[CraftyCore-1.1-PRE.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:542) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:565) ~[paper-1.19.2.jar:git-Paper-270]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:479) ~[paper-1.19.2.jar:git-Paper-270]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:279) ~[paper-1.19.2.jar:git-Paper-270]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1100) ~[paper-1.19.2.jar:git-Paper-270]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:305) ~[paper-1.19.2.jar:git-Paper-270]
at java.lang.Thread.run(Thread.java:833) ~[?:?]```
lovely
I don't think I have a null value?
Oh lol
is the command in plugin.yml
Command isn't in plugin.yml
Is there a place in there for a broken line
i dont see one
What exactly are you doing?
nothing in specific, i do use pdc however. i think itβs already thread safe cause i have a class to represent the data i want stored in the chunk and i use gson to save the object and parse it and blah blah
but i save it everytime i make a change to the object so
No thread safety is not about that
oh alr so iβm good
if i were to create a new runnable and altering chunk pdc would that be potential for error or
Wym create a new runnable?
Are you referring to invoking the runnable on another thread?
Anyway to check for a different event in an even handler
this wont work but i got a good idea tyvm
What event should I use when a player has successfully crafted something?
What are you trying to do?
trying to detect a right click on a stick after jump
here is my code for now
public class doubleJump implements Listener {
public static boolean[] isDoubleJumping = new boolean[2];
@EventHandler
public void checkJump(PlayerMoveEvent e) {
Player player = e.getPlayer();
Vector velocity = player.getVelocity();
// Check if the player is moving "up"
if (velocity.getY() > 0) {
// Default jump velocity
double jumpVelocity = 0.42F; // Default jump velocity
//check if player has potion effect of jump
for (PotionEffect effect : player.getActivePotionEffects()) {
if (effect.getType().equals(PotionEffectType.JUMP)) {
jumpVelocity += (float) (effect.getAmplifier() + 1) * 0.1F;
}
}
// Check if player is not on ladder a\nd if jump velocity calculated is equals to player Y velocity
if ((player.getLocation().getBlock().getType() != Material.LADDER) && (Double.compare(velocity.getY(), jumpVelocity) == 0)) {
isDoubleJumping[0] = true;
player.sendMessage("You jumped");
}
}
}
@EventHandler
public void ballFiring(PlayerInteractEvent event) {
Player player = event.getPlayer();
Action action = event.getAction();
if ((action == Action.PHYSICAL) || (event.getItem() == null) || (event.getItem().getType() == Material.STICK)) isDoubleJumping[1] = true;
if (isDoubleJumping[0] && isDoubleJumping[1]) {
player.setVelocity(player.getLocation().getDirection().multiply(2));
isDoubleJumping[0] = false;
isDoubleJumping[1] = false;
}
}
}
i kinda got lazy w comments
@humble tulip
It is called when "Called when the recipe of an Item is completed inside a crafting matrix."
I need it when the player taking the recipe result.
Isn't that what it is?
declaration: package: org.bukkit.event.inventory, class: PrepareItemCraftEvent
There's also that^^
can i use a switch stmt in an onTabComplete bc i get this when trying to complete
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
List<String> completion = new ArrayList<String>();
switch (args.length) {
case 0:
if (sender.hasPermission("dungeons.admin.music.playfor")) completion.add("playfor");
completion.add("play");
completion.add("stop");
break;
case 1:
switch (args[0]) {
case "play":
ConfigurationSection sounds = Main.getInstance().getConfig().getConfigurationSection("sounds");
for (String sound : sounds.getKeys(false)) {
completion.add(sound);
}
break;
case "stop":
break;
case "playfor":
ConfigurationSection soundss = Main.getInstance().getConfig().getConfigurationSection("sounds");
for (String sound : soundss.getKeys(false)) {
completion.add(sound);
}
break;
default:
break;
}
break;
case 2:
if (args[0]=="playfor") { for (Player player : Bukkit.getServer().getOnlinePlayers()) {
completion.add(player.getName());
};break;}
switch (args[1]) {
case "":
break;
default:
break;
}
break;
default:
break;
}
return completion;
}
Where's rhe console error
Yes
anyway to pause code execution wout stopping the whole server?
BukkitRunnable
thanks
okay i forgot im kinda dumb i just need my code to run after about 8 ticks how would i do that
runTaskLater
mhm figured it out thanks !
Sorry wrong reply
what was the format for a "Date" class in spigot?
hh:MM:ss?
thx
Does anyone know how/if its possible to set a chest animation to be open on 1.18+?
?jd-s
I cant find the nms methods used in 1.17- to do so in newer versions
Literally Chest#open
No nms needed
declaration: package: org.bukkit.block, interface: Lidded
Hey, guys, I'm trying to set a compass that points to a player
public ItemStack getCompass() {
ItemStack compass = CustomItem.runnerTracker();
Location locToGet = player.getLocation();
locToGet.setY(locToGet.getY()+1);
player.getWorld().dropItemNaturally(locToGet, compass);
CompassMeta meta = (CompassMeta)compass.getItemMeta();
Location loc = new Location(player.getWorld(), 0, 0, 0);
for (Player p : Bukkit.getOnlinePlayers()) {
UUID uuid = p.getUniqueId();
if (uuidToPP.containsKey(uuid)) {
PlayerPlus pp = uuidToPP.get(uuid);
if (pp instanceof SpeedRunner) {
loc = p.getLocation();
}
}
}
player.sendMessage(String.valueOf(loc.getX()));
meta.setLodestone(loc);
compass.setItemMeta(meta);
return compass;
}
I manage to get the location of the player
and I set meta.setLodestone(loc), that is, I set the position the compass should point
then, I update the compass ItemMeta
Its not really updating tho
I don't know why
I keep getting this error, is there any way todo it with compatibility for older versions? java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_19_R1.block.CraftBlock cannot be cast to class org.bukkit.block.Chest (org.bukkit.craftbukkit.v1_19_R1.block.CraftBlock and org.bukkit.block.Chest are in unnamed module of loader java.net.URLClassLoader @759ebb3d)
maybe I have to actually create some kind of block for It to point, and Its wrong because Its pointing to an Air location?
Pretty evident what's wrong here error literally tells you
my confusion is that its a org.bukkit.block.Block and ik the block im targetting is a chest
Because Chest is a BlockState, not a Block
Chest chest = (Chest) block.getState();
oh, okay that makes sense
Hi, I'm trying to set a player tracker with a compass
public void updateCompass() {
CompassMeta meta = (CompassMeta)compass.getItemMeta();
Location loc = new Location(player.getWorld(), 0, 0, 0);
for (Player p : Bukkit.getOnlinePlayers()) {
UUID uuid = p.getUniqueId();
if (uuidToPP.containsKey(uuid)) {
PlayerPlus pp = uuidToPP.get(uuid);
if (pp instanceof SpeedRunner) {
loc = p.getLocation();
}
}
}
meta.setLodestoneTracked(false);
meta.setLodestone(loc);
compass.setItemMeta(meta);
}
however
It seems like the compass isn't actually pointing to the position I want
I'm playing by myself, so, the code should make so the compass points to (0, 0, 0)
however, I can't get It to work
I don't understand why
the location is correct
How to make BukkitRunnable run in every iteration of for? BukkitRunnable is now run after all iterations of for.
for (int i = 1; i <= countStates; i++) {
int smeltTime = config.getInt("state-" + i + ".smelt-time");
long doneTime = System.currentTimeMillis() + (smeltTime*1000);
int y = i;
new BukkitRunnable() {
boolean done = false;
int left;
public void run() {
if (done) return;
left = (int) (doneTime-System.currentTimeMillis());
if (left < 0 ) left = 0;
if ( System.currentTimeMillis() >= doneTime ) {
ItemStack item = new ItemStack(Material.valueOf(config.getString("state-" + y + ".item")));
ItemMeta meta = item.getItemMeta();
meta.setCustomModelData(config.getInt("state-" + y + ".modeldata"));
item.setItemMeta(meta);
frame.setItem(item);
done = true;
cancel();
}
}
}.runTaskTimer(Main.getPlugin(Main.class), 0, 1);```
Try deleting compass from player inventory and replace with updated one Immediately. Mby that should work? π
Maybe!!
Why, tho? π€ I thought the compass would update by itself
since I did compass.setItemMeta(meta)
I guess you updating item, but not in player inventory. Idk how to explain in English.
idk, if that will works π let me know
It works!!
thanks!
I actually didn't delete It, tho. I just set the lodestone before dropping the item to the player
which gives the same result
Mby there is better solution, maybe u need only player.updateInventory(); or idk how you get compas as ItemStack. If you get like this: player.getInventory().getItemInMainHand(); I guess your code should work.
Is working thats the point π your welcome
I wonder what I can do to make so It updates every time the player moves, tho. My first thought was to make a listener to detect PlayerMoveEvent and update the item meta of the compass every time the event happens
ooooh, I think I'm gonna try to use the player.updateInventory() method!!
this way I don't have to constantly delete the compass
Mby? Im only guessing π Im pretty new in java π But trying to help.
ye it is, I started with PHP, thats my favorite for some reason
Nah, I only learn some basic and than.. no time for programing π Now Im making my own MC server and I dont have developer, so Im working by my self on that π
i know this dumb but im extremely lost
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
aight ty
sex.java π€¨
where the problem is
else {
new BukkitRunnable() {
@Override
public void run() {
isDoubleJumping[0] = false;
}
}.runTaskLater(plugin, 1);
}
```Error
we dont talk abt that
the whole event listener:
@EventHandler
public void checkJump(PlayerMoveEvent e) {
Player player = e.getPlayer();
Vector velocity = player.getVelocity();
// Check if the player is moving "up"
if (velocity.getY() > 0) {
// Default jump velocity
double jumpVelocity = 0.42F; // Default jump velocity
//check if player has potion effect of jump
for (PotionEffect effect : player.getActivePotionEffects()) {
if (effect.getType().equals(PotionEffectType.JUMP)) {
jumpVelocity += (float) (effect.getAmplifier() + 1) * 0.1F;
}
}
// Check if player is not on ladder a\nd if jump velocity calculated is equals to player Y velocity
if ((player.getLocation().getBlock().getType() != Material.LADDER) && (Double.compare(velocity.getY(), jumpVelocity) == 0)) {
isDoubleJumping[0] = true;
}
else {
new BukkitRunnable() {
@Override
public void run() {
isDoubleJumping[0] = false;
}
}.runTaskLater(plugin, 1);
}
}
}
oh also this "plugin"
.
im too dumb to understand that
Right at the beginning it talks about what you need. π€£
...as i said im dumb. and i dont realize shit- ,also 4% save
public class ClassName implements Listener {
private final MainClassname plugin;
public ClassName(MainClassName plugin) {
this.plugin = plugin;
}
}
okay does this look good?
π
nice
dependenffy infecion
okay
so
erm
how do u check for an item's name
i want to check if stick is named "Movement Stick"
if (item.getItemMeta().getDisplayDisplayName().equals("My Item Name"))
If you want your code to look a lot more better then follow Java Name Conventions
no/
never
thanks <3
sex plugin
no its a combat and movement plugin i just couldnt find a funny name for the main class
my project is literally named after my gf(totally not my dream anime gf mhm)\
ew persistent data containers
pdc is great
in the good old 1.8 days there were none
right but they are so useful
cringe
what should i do
if there is nbt for blocks
so you want new minecraft versions to not add anything?
only for tile entities
blocks with data
chests, furnaces
i want pre swim update
sign?
what should i do here
Can someone explain the playSound() method i found a forum post but it makes no sense also how can i summon a custom firework? after all its an entity right
forum post: https://bukkit.org/threads/playsound-parameters-volume-and-pitch.151517/
you want to summon a firework with playsound?
i want to summon a firework w effects and play a sound
declaration: package: org.bukkit, interface: World
youre looking a really outdated post
refer to the docs
and fireworks have FireworkMeta which can be edited
declaration: package: org.bukkit.inventory.meta, interface: FireworkMeta
well that actually helps my situation cus im using belive it or not 1.8
well either way i think the methods are the same
ehh some things change
but thank you very much
i shall leave now before a herd of humans attack me for using an "old version"
ahsabsdjkabjksd yes
?1.8
Too old! (Click the link to get the exact time)
its not too old.
Try increase volume.
1 volume should be loud enough
maybe use the Sound enum
Sound.ENTITY_PLAYER_LEVELUP π€·
It also has a valueOf method
Writing documentation is the mind-killer.
let copilot do it for you
github documentation unfortunately
then let copilot do it for you and copy&paste it
Xd
https://github.com/MagmaGuy/EliteMobs/wiki/[Guide]-Creating-Custom-Bosses This sucks, I already spent well over 5 hours documenting things and I'm like 1/3 of the way in
and this is just one page
this is killing me
are entity IDs per world or global for the server?
Global. You can teleport entities across worlds
ty!
don't expect to be spoonfed
however, that doesn't mean we can't help you understand
so
16 to 17
how do i write in java
if (age == 16 && 17)?
cause the exercise says that i need to write it only with if and &&
not with else if
so you want to check if their age is greater then 16 and less then 17?
16 to 17
oh, only with &&
yes
what a weird question to teach the usage of &&
alright have you used && in an if statement before?
cause i want to create plugins and mods
no
i use it in a String questions
so && = and in an if statement
it is another way of saying I want to compare with this and also this
so, instead of writing 2 if statements for checking 16 and 17, you would combine the 2 ifs with &&
ohhh
Why would thye show you an if statement that is never satisfied lol
if ((this == that) && (this == other)) {}
oh TY man
so what that says, is the if statement will run only if both those conditions are true
ye but in intellij he tells me that its an error
if (age == 16) && (age == 17)
oh yep
now it works
i am doing programmingbydoing
so
now the reason I said the question isn't quite right for teaching that is because you could do this instead
if ( 16 <= age => 17)
but it really depends what needs to be accomplished
Isn't that always gonna be false?
probably, I don't know what they are working on
i am working on a age calculator
It can't be 16 and 17 in the same time
oh
That doesnβt satisfy the same thing
i need to write liek
if you are 16 to 17
you can drive but you cant vote
and so on
|| ?
it is an example in how using the compare sign might be better then using &&
not that it should be used like that
|| - OR
&& - AND
Change the symbols
don't forget ^ XOR
frostalf did you ever use flowgorithm
?
they learned me that at school
its like a program to create algorithms
and i dont really suck at that yk
thank god you learn it in the old fashion way
cause it SUCKS
its like really closed as a program
you use shapes
and much more
you dont write codes
well that is because it isn't for the purpose to learn programming algorithms rather to understand them in how they work
imagine that i need to go from flowgorithm to c# and c++ π
if you can understand how an algorithm is supposed to work, then you know in how it should need to be programmed or how the concept needs to work
and do html
yk i would like to do some cool things at school like py, js and css
i am not saying that c# and c++ sucks
but
its difficult
you don't have to be at school to do cool things
ik ik
i am trying to learn a lot of languages
like c# c++ py
i wanna start with java
so
i am starting with java
when I was in High school, I hosted and ran one of the school clubs websites from home π
it ran on a pentium 3 with 1gb of ram π
lool
pentium 3 its like old gen my guy
only 90's old gen π
I ran it on 512 megs
Back in a day
yooo what all yall saying
#general
i am the only tech guy at school that really know this things
even the teachers are impressed
idk why
so was I, and hence I ran the website for like 6 years
and then the club shut down. I was known as the ghost founder of the club π
mainly because I never really went to school
The name of the club was called Legion Tech Club basically a club that revolved around technology and of course anyone was free to join
I am one of the founders of it π
Which host is good for a US based vps?
anyways, I ran the website for that club and was the only founder who did so, but like no one ever saw me just knew that I was the mysterious founder never present π
Yes... Coby actually goes to SPACE!! Huge thanks to MoonDAO for sponsoring this video! MoonDAO's mission is to decentralize access to space research and exploration. Learn more here:Β https://moondao.com/dude-perfect
βΊ Thanks for subscribing! - http://bit.ly/SubDudePerfect
βΊ Sail to the Bahamas w/ us on the DUDE PERFECT CRUISE: https://www.dude...
And walking simulator
it was awesome because when I did show up, people would gather to just actually see me XD
so they could say, they saw the ghost
Rare NPC π
love this analogy
Is this safe to use in production and decent to work with?
About what

age calculator
?whereami
hetzner maybe?
otherwise ovh if you got the money
but this is more a #help-server
Oh fuck it's help development
OVH does exist in the US, their Montreal data center however is also not that bad either in terms of US
Sorry. Misread.
Is there a way to check if a pressure plate is pressed outside of the PlayerInteractEvent (so just checking the current state)
ayy I spilled my drink on my keyboard
reset the clock, my average is now once every 5 years
get BlockData and cast to either powerable or AnaloguePowerable
probably
like if an item or an entity activates it for example?
not sure if that would work for pressureplates
since pressure plates do not implement or extend those interfaces
however, there is this though. https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/material/PressurePlate.html#isPressed()
declaration: package: org.bukkit.material, class: PressurePlate
Looking at the javadocs pressureplates are not mentioned at all, other than deprecated and told to use BlockData
while it is deprecated it should still work since there really isn't a replacement for such things
Yep
Like when a player is standing on it
I want to check if he is standing atleast 5 seconds on it to execute something
how to pass argument to the task with that construction?
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {
}, 40);
So?
BlockData and casting to powerable?
I mean I'll tried to cast it to PressurePlate
Is not working,.
you want to listen for a player stepping on a plate and see if they stay on it for 5 seconds
Yep
I mean I just need to check if the pressure plate is still pressed after the PlayerInteractEvent
Only problem is to check if it is pressed
get the block in question and check if its a pressure plate
if so, just use PressurePlate.isPressed()
you can try the casting, but I doubt it will work
Already tried
I don't mean to cast to PressurePlate
why is it that new WorldCreator(worldName).createWorld(); or Bukkit#createWorld(WorldCreator) freeze the server when loading the world?
You can't cast BlockData to pressure plate first off and second it should be Block
you can cast a Block to PressurePlate
Does it only work with Wood_plates?
because there is a lot going on when it creates a new world. Second it depends on your JVM arguments and resources available to the server
should work for all of them o.O
that is why I said get the block
how to pass something to the delayed task so it will be the same that at the moment when task was created? (i need to do it every tick)
what do you mean by this?
how do I stop it?
or create a world without that
?flags
Aikar's garbage collection flags: https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/
there we go
that would be the first thing to try
the third thing would be to not create the world
you could instead just make pre-generated worlds and just call load(world)
loading a world is not as resource consuming as creating one
if i create delayed task its just a pice of code that will be executed after some time, but i need some parameter in condition that it was at the time when task was created
I am not understanding that last part
are you wanting variables in a scheduler?
like, are you needing to figure out how to come up with the time to feed into the method to create the delayed task? o.O
i want it to save some variable until it will be executed
create the variable and set it before the scheduler?
yes, but it changes every tick
what is the variable meant to be, like what are you saving
Location
check if it matches in the scheduler then run a method if it does
matches to what?
what your checking
i didnt meant that
or do you just need to save their location every tick
ye, and use that value after 20 ticks
in BukkitScheduler
but i dont know how
maybe i need some kind of buffer
i im pretty sure it have to be easier
Not working.
[13:56:01 WARN]: [CraftFactory] Task #6161426 for CraftFactory v0.4 generated an exception
java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_19_R1.block.CraftBlock cannot be cast to class org.bukkit.material.PressurePlate (org.bukkit.craftbukkit.v1_19_R1.block.CraftBlock and org.bukkit.material.PressurePlate are in unnamed module of loader java.net.URLClassLoader @25f38edc)
at me.katze.cf.games.winterevent.goatfight.GameHandler$4.run(GameHandler.java:202) ~[cf-0.4.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.19.jar:git-Paper-29]
at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[paper-1.19.jar:git-Paper-29]
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1490) ~[paper-1.19.jar:git-Paper-29]
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:446) ~[paper-1.19.jar:git-Paper-29]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1414) ~[paper-1.19.jar:git-Paper-29]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1187) ~[paper-1.19.jar:git-Paper-29]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:302) ~[paper-1.19.jar:git-Paper-29]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Just don;t use a lambda and pass the variable in the constructor
try doing this instead then
?
mans casting the block itself
hold on
instead of the state or data
Its just the Block not data or anything
you were correct you can cast pressure plate to powerable
it says: Expected 0 arguments but found 1
ik im bad at oop
idk man
neither of these extend Block
Already tried to Cast BlockData to Powerable not working
java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_19_R1.block.impl.CraftPressurePlateWeighted cannot be cast to class org.bukkit.block.data.Powerable (org.bukkit.craftbukkit.v1_19_R1.block.impl.CraftPressurePlateWeighted and org.bukkit.block.data.Powerable are in unnamed module of loader java.net.URLClassLoader @25f38edc)
That was the error I got then
I'm very confused rn. Did something change between 1.19.2 and 1.16.4 regarding external libraries?
BlockData data = Block.getBlockData()
if (data instanceof Powerable) {
(Powerable) data;
}
if (data instanceof AnaloguePowerable) {
(AnaloguePowerable) data;
}
probably
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
Okay thx I will try it
heavy weighted pressure plates are an instance of AnaloguePowerable
hence why I included it above
but with the examples above you should be able to work it into your code to work π
woah what's that black magic? bootstrap for mc plugins? o.O
well that is mainly for those who use NMS and previously depended on the server jar. But it also applies to the dependencies in the server jar too
not sure if that is what you were asking
reason I didn't add anything is because you need to use the methods available to data after casting
can't spoonfeed you everything
I gave enough code that you should be able to work out how to do it from there
Okay
that was exactly what i was asking :)
does that mean i don't need the server jar as external library anymore?
Btw light weighted also?
those two instanceof's should cover all the types of pressure plates
Oh, CraftPlayer and EntityPlayer doesnt exist anymore? o.o
i cant seem to find it at least. welp. time to find out again how to make a /ping command
well, CraftPlayer is from craftbukkit and EntityPlayer is from NMS
sorry, NMS? i guess i missed a chapter
net.minecraft.server
it was in spigot before though
ah
They still are, but a restructure in how everything looks happened
I think back in 1.17?
oh boy, that's what i get for coding in 1.16 for a whole bunch of time
lol
i started my plugin at 1.8, ported it to 1.16 (fairly easily) and now i'm confused lmao
just when you thought you wouldn't be outdated
you learn you already are and for quite a while
yeaaah
i'm so heavily confused by the ping thing
shit
before you were able to do that like this:
CraftPlayer cp = (CraftPlayer) p;
EntityPlayer ping = cp.getHandle();
return ping.ping;
}
now that CraftPlayer and EntityPlayer doesn't exist anymore... i'm fucked essentially
declaration: package: org.bukkit.entity, interface: Player
they still exist, just the way you depend on the server jar is different, hence I gave the link for bootstrap
but, you can get the ping from the API though
oh, there's a method now
so maybe not all is lost and might be easier for you now π
i feel stupid
you should read the post for bootstrap and the following post it directs to. It will tell you how to setup maven appropriately to depend on the server jar if you really need that
but if all you were needing was just the ping, well you can just stick with the API now π
The rest in the plugin is working fine i guess
it built at least
let's see if it works
everything works, hell yeah!

Wouldn't cancel just cancel the current iteration and not the scheduled service
I think cancel stop the whole scheduler
What does the docs say for it? Add some logging to see if that's the case.
If you put an info log into that if you'll find out if it works or not
Question is there a way to check from a list of locations what is the nearest from the player location and teleport them then there ?
loop the list and use Location#distance
distanceSquared pls & ty
And then check what the lowest is?
Beware of comparing the World first though
How to make BukkitRunnable run in every iteration of for? BukkitRunnable is now run after all iterations of for.
int smeltTime = config.getInt("state-" + i + ".smelt-time");
long doneTime = System.currentTimeMillis() + (smeltTime*1000);
int y = i;
new BukkitRunnable() {
boolean done = false;
int left;
public void run() {
if (done) return;
left = (int) (doneTime-System.currentTimeMillis());
if (left < 0 ) left = 0;
if ( System.currentTimeMillis() >= doneTime ) {
ItemStack item = new ItemStack(Material.valueOf(config.getString("state-" + y + ".item")));
ItemMeta meta = item.getItemMeta();
meta.setCustomModelData(config.getInt("state-" + y + ".modeldata"));
item.setItemMeta(meta);
frame.setItem(item);
done = true;
cancel();
}
}
}.runTaskTimer(Main.getPlugin(Main.class), 0, 1);```
?main
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
need to start recording these commands
lol
with the above I have no idea which tasktimer they are using
I would assume its a delayed one?
your math is wrong for the timing just fyi
time is same in every iteration of for if I let it print
So thats the problem π If I let print some string in runnable is printing run1 and run2 in same time.
the appropriate math for converting ticks to milliseconds is as so (ticks / 20) * 1000 if we assume ticks is 5, then its 250ms with the math above that you have, it would translate to 5000ms instead which is not accurate at all.
But im not comparing tick Im comparing time. And problem is, for1 runs, for2 runs and than Runnable. I need to for1 runs, Runnable runs, for2 runs.... etc.
and In config Im setting time in seconds
I am aware you are comparing time, but your time is incorrect due to incorrect math
if we use my example above, and lets say smelt time is only 5 ticks. You are saying time wise it is 5 seconds when really it is 250ms
that is how far off your time math is
I dont see thats a problem. Problem is, If I set first time to 10 secodns and secound to 11 seconds, first change will happen after 10 seconds and second change will happen after 1 sec after the first one.
I have tested that
alright keep living with incorrect math and code then
you don't see its a problem then I don't see you having a problem above and thus don't require help from me will leave it to someone else to help π
Im probably dumb, but I relay dont know where is problem.
well you refuse to fix something pointed out as probably a problem. Generally it is best to fix all that is wrong as people go through to help.
System.currentTimeMillis() >= doneTime since you are comparing time here
I have pointed out your math for calculating done time
is flawed
I gave you the appropriate math above to fix that
Ye Im comparing time here. So if done time is ex. 1500 and time is 1501 that true and think is done. Or do I miss something? Gona read again.
is not delayed one btw. I notice this now, is running every tick
you are converting ticks to milliseconds incorrectly is what I am saying
there is only at most 20 ticks in 1 second. Well to convert to seconds, we have to divide the ticks by 20 and then to convert to milliseconds multiply that result by 1000
therefore (ticks / 20) * 1000 = ticks_converted_to_milliseconds
Idk if I understand correctly, but this is how I understand think. Ex. if system time is 1000 and smeltime is 5 and than I make *1000 to get milliseconds. So if I count 1000+5000 is 6000, so when time hit 6000 is makred as done
That how I understand my code
but System.currentTimeMillis() is not in ticks, is it?
no, its milliseconds
Im not working with ticks, Im working with miliseconds
I am assuming you are grabbing the smelt time from the API? Like from a furnace. if so the time is in ticks
and with seconds in config
No, Im grabing smelt time from config
Is not actually smelting in furnace
Im just making smeling like in biiiig furnace. So its looks like, fire and above him is itemframe where you smelting the item.
I should post more of the code, my bad
it would be better understood
I think the part where it might be going wrong in your code as for your issue is most likely this
The problem is the BukkitRunnable think is running after all for is done
if (done) return;
I believe it should instead be if(!done) return;
the way you have it, says if done = true return
the way I have it, says if done does not equal true (AKA if its false)
Ye, bcs done is set to false on begining of the for loop. And If time hit requested variable Im seting done to ture. Thats why Im returning if done is true, no needed to run Runnable again
if it were me I would re-write that piece of code to be this instead
how does it calls field abvoe hpbar?
if(!done) {
return;
} else {
cancel()
}
I would probably do that instead, in this manner it is checked if the runnable should be running or not
I gona try. But I need to run Runnable INSIDE for iteration and thats not happening.
probably because there isn't anything to invoke run
do this instead
BukkitRunnable taskRunnable = new BukkitRunnable() {
boolean done = false;
int left;
public void run() {
if (done) return;
left = (int) (doneTime-System.currentTimeMillis());
if (left < 0 ) left = 0;
if ( System.currentTimeMillis() >= doneTime ) {
ItemStack item = new ItemStack(Material.valueOf(config.getString("state-" + y + ".item")));
ItemMeta meta = item.getItemMeta();
meta.setCustomModelData(config.getInt("state-" + y + ".modeldata"));
item.setItemMeta(meta);
frame.setItem(item);
done = true;
cancel();
}
}
}.runTaskTimer(Main.getPlugin(Main.class), 0, 1);
for (int i = 1; i <= countStates; i++) {
int smeltTime = config.getInt("state-" + i + ".smelt-time");
long doneTime = System.currentTimeMillis() + (smeltTime*1000);
int y = i;
taskRunnable.run()
}
think that should work
π₯πΆ
but, you might be better off with making a task instead of using runnable possibly
it isn't spoonfeeding, they already had the code
I was showing how it needs to be because their current code, nothing is invoking the run method
How can I turn world sides ( North,West.. ) into vector?
why would you want to do that?
a vector from the API takes coordinates
coordinates or a location
well I want to create line of block going in a direction
but it isn't ever straight
That's simple and can be hardcoded
well I didn't want to hardcode it
soo I was looking for some solutions
Idk how it is but let's assume north is positive x, the vector will be 1,0,0
South is - 1,0,0
well there is 8 directions
East will be 0,0,1
West will be 0,0-1
That's assuming positive x is north, you cqn check what it is frm ingame
BlockFace face = BlockFace.NORTH;
Vector vec = new Vector(face.getXMod(), face.getYMod(), face.getZMod());```
imma check it
thx
ooh tysm
If(true!=false) { return true;} else{ return false;}
Make this a static method that accepts blockface and returns the vector
return true;
works like a charm
thx again
you may be able to just use getDirection() on the BlockFace
depends which way you are wanting it
if you want it from the players perspective you would need the opposite face for the appropriate
you can remove the else if you're doing returns
it only returns if done is false
if it is true, it actually does something
I mean I suppose they could just move their code below into that if statement lol
you don't need the else
yes
unless you're doing nested ifs and have a weird structure
but like
why would you
it doesn't need to return, it needs to cancel the task
I've previously used this line of code to set the message format in chat, in the AsyncPlayerChatEvent, however it seems that newer versions of Minecraft cause an "message has been modified by the server" warning to the player. Any way I could prevent that?
event.setFormat(player.getDisplayName() + " Β§7Β» " + (player.hasPermission("chat.white") ? "Β§f" : "Β§7") + msg);
Is there a new better method to set the "format" without being able to modify the player's message?
hm, is there a way to regenerate the map?, im trying to make a minigame but dont know how to setup servers like hypixel does
so if i have a arena thats gonna get blown up, i want it to regenerate after finishing a game
sorta like tnt run
keep a copy of the world in question AKA master. On the world needing being replaced ensure world saving is disabled upon end of game, unload the world delete the world files, copy world files from master then load world
voila, arena back as new π
Couldn't you have a blueprint world loaded and just rebuild the world using that?
Hello I'm trying to change a block's appearance when its placed. This is what I've done:
@EventHandler
public void onPlace(BlockPlaceEvent event) {
ItemStack placed = new ItemStack(event.getItemInHand());
if (placed.isSimilar(CustomBlockItem.custom_block)) {
Block block = event.getBlock();
block.setMetadata("aa", new FixedMetadataValue(plugin, true));
Player player = event.getPlayer();
player.sendBlockChange(block.getLocation(), Material.OAK_LOG.createBlockData());
}
}```
everything here works unless the last line
it doesn't change the block's texture to oak
This is the functionsendBlockChange(@NotNull Location loc, @NotNull BlockData block);
it requires a blockdata
A solution was to delay the change by a tick
yeah
I have another question, do you know how to prevent the block from going back to it's orig texture?
when you click on it
I thought about using PlayerInteractEvent but this also detects when a block is placed
Yeah no you need to be a bit more severe
@EventHandler(priority = EventPriority.HIGHEST)
public void onTouch(PlayerInteractEvent event) {
if(event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock() != null) {
if (event.getClickedBlock().hasMetadata("aa")) {
event.setCancelled(true);
}
}
}```
this is what i did
Intercept packets n all
which doesn't work
do you know how?
can you send it?
that is a lot of code lmao
thats not correct getting lot of error in Runnable, but I get your point. Gona try.
I am going to assume the errors you are getting has to do with accessing variables that are outside of that runnable
which are accurate and means you need to re-structure your code
another way you could do it, would be to make a class that implements runnable
I will probably put Runnable in method and send variabels to it that should solve problem mby?
That could work if I understand what you said correctly
Im going to do like this: public void runThis(variabels) { Runnable }
might as well make a class that implements runnable then
and then you could just have a method that calls that class
or pass the variables to that class
Is not needed to make a class I gess, If I can make only method
well you may still encounter the same problem because you would still need to create an inner class
or you could try instead of using a runnable to use a bukkittask
?scheduler
?scheduling
ye, .runTaksLater should be better option mby. gona try
We set the skin on the player data so this should also effect tab
you can test this out by sideloading online mode using fastlogin
you could use a mod to still display it, but i don't recommend that
(ps, sorry for late responce)
what is the advantage of creating a singleton class when you could just make every field/method static with a private constructor. If its only meant to be instantiated one time, why not just make it static? I don't fully understand singleton pattern
or is the pattern to be used for lazy loading, only load when someone actually needs it
this piece of code is supposed to launch away all hostile mobs but it only flings away one
Location#getDirection gives you the direction tje zombies are facing
Since 1 zombie was facing you, he was thrown towards you but couldn't move due to the blocks
If you want the zombies to be thrown away from you, get zombie location.toVector subtract yourLocation.toVector
And set their velocity as that
You can also normalize it so all are flung the same distance
well yes i get that but it only launhes away one
Um that is not what your code does
Your code flings the zombie in the direction they're facing
....
i get taht.
but
there is 4 zombies
but only one of them gets launched
others dont move.
could they already be in the corner?
ill try it again once i appy minions fi give me a second
That's why
They were facing the corner
somth like this?
what this?
ehh ill keep it! makes iit easiser for me to read
Lol i mean after you subtract use the normalise method
Currently, the further away a zombie is the further it'll be thrown
also it works thank u sm!
Np
what you trying to?
i get the math now
i love that we can just see console just dying with errors
its just random null pointers i cba asked to fixed
it barley even chnages the performace
my thing works perfectly im afraid that ill breka it if i try to fix them
so they stay
null checks

no.
also i dont think ClassCastExceptions are NPE's
ππ
You should fix it
full log
somewhere in here
lmfao
why what why why why why why why, no
?paste us a full error
use the scheduler instead of instantiating bukkitrunnables pls
Bukkit.getScheduler().runTaskLater(plugin, task -> { task.cancel(); }, 2);```
with pleasure
declaration: package: org.bukkit.scheduler, interface: BukkitScheduler
ill show myself out
check line 35
also where are ur naming conventions
shh.
?
its not a serious plugin
I have another question, ```java
@EventHandler
public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
for (Map.Entry<Location, Block> block : PlaceListener.map.entrySet()) {
Bukkit.getScheduler().runTaskLater(plugin, () -> player.sendBlockChange(block.getValue().getLocation(), block.getValue().getBlockData()), 5);
}
}
I have this code but the sendBlockChange doesn't take effect and I think it's because the chunks aren't loaded, is there a way to wait for them to load then run the sendBlockChange?
its just somth me and the bois would use for 5 days and never use again
1+1
cosntkb.sex
mhm
its main class
lmao
...its main
imagine VillagerSexEvent
i mean how hard would it be to place a stalactite(?) under a player
no thats from the celing
stalagmite is floor
thats why the (?)
sex plugin
cursed
hasbhmbd STOP LMAO
sex.java
i hd a project named I love b**bies
why
why not
what did it do lol
this one is name after my ex
like revive in hardcore?
const?
ooh
id be so much happier if it was Sex plugin
mb
yeah
soon.
couldnt take the time to fix the const
vanesa sex plugin
i used to have one somewhere someone else made
never
wasnt like dream cancelled because people said he made a minecraft sex mod lool
if it wasnt obvious my whole coding folder is a joke
same
no idea
i dont personally keep tabs on dream
ahaaha
nah i used to watch his videos and then i got all this cringy dream smp content shoved in my face
the 1st one is a custom domain sexmail.com
have u read anything
if my project is named after my ex and my main class is sex why would i care abt my naming conventions, not like someone else is viewing it
π
i doubt it exsists
even if it did id make my own cus i get bored and need to do smth else
how do i make a firework
the docs
are not helpful
wait nvm
?
ItemStack itemStack = new ItemStack(Material.OAK_DOOR);
e.getBlock().getLocation().getWorld().dropItem(e.getBlock().getLocation(), itemStack);
e.setDropItems(false);
How can I make the block that drops can't be taken?
BlockBreakEvent
does this look right?
https://paste.md-5.net/nuqexorahi.css error on startup
nvm found it
Firework firework = (Firework) player.getWorld().spawnEntity(player.getLocation(), EntityType.FIREWORK);
FireworkMeta meta = firework.getFireworkMeta();
FireworkEffect.Builder builder = FireworkEffect.builder();
builder.withTrail().withFlicker().withFade(Color.GREEN, Color.WHITE, Color.YELLOW, Color.BLUE,
Color.FUCHSIA, Color.PURPLE, Color.MAROON, Color.LIME, Color.ORANGE)
.with(FireworkEffect.Type.STAR);
meta.addEffect(builder.build());
meta.setPower(2);
firework.setFireworkMeta(meta);
Error:
oh- how do i fix that
welll my code make sit w color
wait
actually
nvm found it
can someone rate my code? i'll send link to github repository in private message
Why in a private message?
idk if i'm allowed to send links here
Iβm pretty sure GitHub links would be fine but I would wait for someone else to answer, or you can send it in a paste
?1.8
Too old! (Click the link to get the exact time)
π©΄
alright