#help-development
1 messages · Page 1689 of 1
lombok 🤮
Looks like this class is reserved for EntityHuman only.
public void onMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
if (cooldown.containsKey(player)) {
if (event.getPlayer().isOnGround()) {
cooldown.put(event.getPlayer(), false);
}
}
}```
isOnGround is depracted. Why? I doesn't work ingame because its depracted
The name is included in the metadata packet. I just checked.
Its deprecated because it could be faked by the player.
And how do I solve this problem?
Check the block right below the player and see if it is not air.
THe method works but can be tricked.
Yeah I guess that works too
Nice. Then it should work.
im asking how to send them at the same tick
so the armor stand doesnt appears normaly for 1 tick
Just send them right after each other
ok the name is not working
Location eloc = event.getEntity().getLocation();
EntityArmorStand as = new EntityArmorStand(((CraftWorld)eloc.getWorld()).getHandle(), eloc.getX(), eloc.getY(), eloc.getZ());
as.setInvisible(true);
as.setNoGravity(true);
as.setInvulnerable(true);
as.setMarker(true);
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutNamedEntitySpawn(PacketDataS);
PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(as.getId(), as.getDataWatcher(), true);
String text;
if (event.getDamager().isOnGround()) {
text = Utils.translate("&c- &f" + Math.round(event.getDamage()));
} else {
text = Utils.translate("&c- &e" + Math.round(event.getDamage()));
}
as.setCustomName(IChatBaseComponent.a(text));
as.setCustomNameVisible(true);
((CraftPlayer) player).getHandle().b.sendPacket(packet);
((CraftPlayer) player).getHandle().b.sendPacket(metadataPacket);
I'm glad someone else agrees 
if (player.getLocation().add(0,-1,0).getBlock().getType() != Material.AIR) {
cooldown.put(event.getPlayer(), false);
}```
Like this?
You're setting the name after sending the Metadata packet.
Set it right after as.setMarker(true)
Okay, it just changed nothing... could someone send me the code to paste it in?
hgow would i find what time of day it is
Ingame or real time?
ingame
World world = ...;
long dayTime = world.getDayTime();
long time = world.getTime();
could you maybe help me with my problem? :c
Whats the problem exactly?
Show some more code pls
package de.leleedits.lobbysystem.listeners;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerGameModeChangeEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import java.util.HashMap;
public class DoubleJumpListener implements Listener {
private HashMap<Player, Boolean> cooldown = new HashMap<>();
@EventHandler
public void onJoin(PlayerJoinEvent event) {
event.getPlayer().setAllowFlight(true);
cooldown.put(event.getPlayer(), false);
}
@EventHandler
public void onFly(PlayerToggleFlightEvent event) {
Player player = event.getPlayer();
if (event.getPlayer().getGameMode() == GameMode.SURVIVAL || event.getPlayer().getGameMode() == GameMode.ADVENTURE) {
event.setCancelled(true);
if (cooldown.get(event.getPlayer())) return;
event.getPlayer().setVelocity(event.getPlayer().getLocation().getDirection().setY(1));
player.playSound(player.getLocation(), Sound.WITHER_SHOOT,1.0f, 1.0f);
cooldown.put(event.getPlayer(), true);
}
}
@EventHandler
public void onMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
if (cooldown.containsKey(player)) {
if (player.getLocation().add(0,-1,0).getBlock().getType() != Material.AIR) {
cooldown.put(event.getPlayer(), false);
}
}
}
@EventHandler
public void onGamemodeChange(PlayerGameModeChangeEvent event) {
if (event.getNewGameMode() == GameMode.SURVIVAL || event.getNewGameMode() == GameMode.ADVENTURE) {
event.getPlayer().setAllowFlight(true);
}
}
}
Thats my whole Listener Code
If I do double jump theres no cooldown. So I can do it every milisecond in the air. But I only should be able to do it if im on the ground
getworldtime is not a value
What are you trying to achieve with this cooldown map?
It resets when the player is on the "ground"
But there are a number of reasons that might not work
- VOID_AIR
- CAVE_AIR
- Non-solid blocks
It's also worth noting that the player is probably at less than 1 block above the ground when they jump
if (player.getLocation().add(0,-1,0).getBlock().getType() != Material.AIR) {
->
if (!player.getLocation().add(0,-0.05,0).getBlock().getType().isAir()) {
So you get 1 block below, and it still gets the ground block
You probably want player.getLocation().add(0, -0.1, 0).getBlock().isSolid()
cannot resolve isAir()
You're using fucking 1.8 aren't you
yes
🤦
Use this
cannot resolve isSolid
Does 1.8 not have that??
Cannot resolve method 'isSolid' in 'Block'
Sry but then ill have to recede
I dont think so
get the material instead
give me 1min, Ill try it now
At some point I might have to follow suit with 7smile and stop offering support to people using 1.8
still the same, as before
I'm literally looking at the spigot 1.8.8 docs right now
And isSolid() is a method of Material
you're doing something wrong lele
what is it?
show the code
package de.leleedits.lobbysystem.listeners;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerGameModeChangeEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import java.util.HashMap;
public class DoubleJumpListener implements Listener {
private HashMap<Player, Boolean> cooldown = new HashMap<>();
@EventHandler
public void onJoin(PlayerJoinEvent event) {
event.getPlayer().setAllowFlight(true);
cooldown.put(event.getPlayer(), false);
}
@EventHandler
public void onFly(PlayerToggleFlightEvent event) {
Player player = event.getPlayer();
if (event.getPlayer().getGameMode() == GameMode.SURVIVAL || event.getPlayer().getGameMode() == GameMode.ADVENTURE) {
event.setCancelled(true);
if (cooldown.get(event.getPlayer())) return;
event.getPlayer().setVelocity(event.getPlayer().getLocation().getDirection().setY(1));
player.playSound(player.getLocation(), Sound.WITHER_SHOOT,1.0f, 1.0f);
cooldown.put(event.getPlayer(), true);
}
}
@EventHandler
public void onMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
if (cooldown.containsKey(player)) {
if (player.getLocation().add(0, -0.1, 0).getBlock().getType().isSolid()) {
cooldown.put(event.getPlayer(), false);
}
}
}
@EventHandler
public void onGamemodeChange(PlayerGameModeChangeEvent event) {
if (event.getNewGameMode() == GameMode.SURVIVAL || event.getNewGameMode() == GameMode.ADVENTURE) {
event.getPlayer().setAllowFlight(true);
}
}
}
is there a way to completely remove bossbars or do you just have to remove all players from it?
you're quite sure you're using 1.8.8? not some other version?
spigot 1.8.8
1.8.8-R0.1-SNAPSHOT Spigot-API
Have you tried
bossBar.setVisible(false);
(PS: Not possible with EnderDragon battle bar)
Or do you want to remove it all together?
bossBar.removeAll();
My problem is that I keep creating bossbars and Im worried thats gonna take more and more memory
the documentation for removeAll() is just that it removes all players, not that it removes the bossbar
If you dont have a reference to the BossBar and no players are viewing it then it gets collected by the GC
so you dont have any other ideas how to fix this issue?
ok then I should be fine with removing it from the hashmap I set it to as a value and removeAll?
yeah I got no idea, I have literally 1.8.8 imported on my IDE and it works 🤷
So if you do the double jump you only can do it again if you toutched the ground once?
I have no idea what you're talking about... I wasn't paying attention to whatever yall were talking back then
If I keep spamming my hotbar I do 1 big jump and than a loot of little jumps in the air. But I only wanna do the big jump, yk?
Hint: One day has 24000 ticks in total.
One min. Im also writing something.
with event.getentity().getType() how do i find a specific entity type
What does spigit measure vectors length in, I should have a vector about 10 blocks long but its length is 274.739.....
if(event.getentity().getType() == EntityType.SHEEP) {
The base unit is blocks.
The BoundingBox of a Block is 1x1x1
Did you start with a unit vector? (normalized)
if want to be able to use it like sheep.getmetadata what would i use
like EntityType creeper = e.getEntity().getType() == EntityType.CREEPER;
but that does not work
e.getEntity().getType() == EntityType.CREEPER
This is a boolean expression. So it will return a boolean.
"Is the type equal to CREEPER" -> true/false
Ahh my mistake, endLocation.toVector().subtract(startLocation.toVector())
Is there a way to, when one event happens, for a certain amount of time listen for another event and then do something?
how would i find the name of a item bieng held bc i dont thing .getName() for items is a thing
It depends really
If you want to user-provided name use item meta for that, otherwise Classloader hacks
?pdc
stupid question here: how do I catch a stackoverflow?
How do I replace org.bukkit.material with org.bukkit.blockData in the 1.17.1 API? I'm trying to call some info about cauldrons. Like what they are above, if they are filled. I'm already using org.bukkit.block.data.Levelled to get the water level of the cauldron.
its just a normal error
item1.addEnchantment(Enchantment.DURABILITY, 1);
meta1.addItemFlags(ItemFlag.HIDE_ENCHANTS);
``` I try to glow my gui items without the enchantment names visible but this gives me ERROR: null, why?
I got
try {
// recursive call
} catch (Throwable e) {
e.printStackTrace();
}
this won't work because of obvious reasons (i. e. it generates a stack overflow when generating the stacktrace)
public static void main(String args[]) {
try {
main(null);
}
catch (StackOverflowError e) {
System.out.println("Heap size reached");
}
}
???
Heap size reached
Compute time: 0.49 sec(s)
huh, apparently the JVM handles StackOverflowError differently to throwable
Well, why else would I get
java.lang.NoClassDefFoundError: Could not initialize class java.lang.StackTraceElement$HashedModules
java.lang.NoClassDefFoundError: Could not initialize class java.lang.StackTraceElement$HashedModules
java.lang.NoClassDefFoundError: Could not initialize class java.lang.StackTraceElement$HashedModules
java.lang.NoClassDefFoundError: Could not initialize class java.lang.StackTraceElement$HashedModules
[...]
when doing catch (Throwable e but nothing if I do catch (StackOverflowError e
because catching throwable has never and will never be reccommended
Throwable
| \
| Error -> Instant Death
|
Exception
worst case scenario you're even catching ThreadDeath
Perhaps you should just never try to catch Stack overflows, that's perhaps a better option
of course
or just fix your error
if your program ever throws StackOverflowError theres a major issue
or you just hit the JVM’s limit, but at that point you might be interested in trying to change it to a non-recursive program lol
the website!
Full of arrogant assholes!
such as yourself!
😢
So I have a issue where when setting a custom ai goal for a entity, it stops one node before the actual target location
How'd I fix that?
Bukkit#getOfflinePlayer(String) is deprecated, I'm trying to run a /punish <player> how would I go about getting their UUID?
getPlayer
getOfflinePlayer is useless when it comes to names, since they can be changed after leaving the session
Understandable, but what if I want to get an offline player?
For example i find an cheater, the leave, and I want to /punish them. How will I go about that?
well you could use the deprecated method
The only downfall being if they change their name between when they leave and I /punish?
alternatively, get rid of the notion of usernames on your server and have everyone use their UUID as their name
Great idea! Problem solved!
but for real, you will have to use the deprecated method or keep track of UUIDs yourself (which does the same thing)
^
Alrighty then thank you!
Considering I'm using Litebans I believe that tracks all the usernames and uuids, I'll just hook is database
is there a way to use ChatColor with hex color codes?
google it
i did , it said to use ChatColor.of() but it doesnt have the .of attribute, and valueOf also threw an error.
import bungee chat
ok
I have a plugin that clears the player's PlayerInventory when opening a custom gui/inventory and I'm trying to make it store the previous inv to restore it once they close the gui.
I'm a bit new to programming spigot plugins so i'm not quite sure how to achieve this task.
public PlayerInventory previous_inv;
@EventHandler
public void onOpen(InventoryOpenEvent event) {
if (event.getInventory() != CoreInventories.server_selector) {
return;
}
previous_inv = event.getPlayer().getInventory();
if (previous_inv != null) event.getPlayer().sendMessage("Successfully saved inventory");
}
@EventHandler
public void onClose(InventoryCloseEvent event) {
Player player = (Player) event.getPlayer();
if (!(event.getInventory() == CoreInventories.server_selector)) {
return;
}
PlayerInventory inv = player.getInventory();
inv.removeItem(CoreInventories.survival_item, CoreInventories.creative_item, CoreInventories.prototype_item);
player.getInventory().setContents(previous_inv.getContents());
player.updateInventory();
event.getPlayer().sendMessage("End reached.");
}```
This is what i have for my listeners but still to no avail
Hey is anyone fimiliar with spigot servers, macos, and mysql?
I really need help
record PlayerInventoryContents(ItemStack[] armorContents, ItemStack[] extraContents, ItemStack[] storageContents[]) {}
Map<UUID, PlayerInventoryContents>
just ask
ask the question
Oh
Lmao
So basicily i am in minecraft hosting a server and for some reason mysql workbench can connect just fine to the mysql instance, but the minecraft plugins that need mysql cannot.
Ok.
Would this be a more safe option? SQLBridge is connecting to the litebans SQL database
^ removed #getPlayer() it wasn't needed.
that is going to return null if they are offline
not to mention the fact you lock the main thread if SQLBridge isn't a cached value and it actually makes a connection
What kind of file do I need to create to achieve something like
userData.getLevel().max();
userData.getLevel().current();
Like what would getLevel have to be for me to do this
BlockBreakEvent
What error
you can't just send the link
you're compiling java 16 but the server's not 1.17+
set your java version in your pom/gradle file to 1.8
the java version you're building
send console log
if theres anything wrong there's gonna be an error
it shouldnt matter, but try Bukkit.getLogger().info("Works!");
yeah
just try it
🤷♂️
If a player triggers bungee's LoginEvent do they 100% call the PlayerDisconnectEvent if they cancel the login before ServerConnectEvent
System.out is broken because bukkit/spigot only uses the logger
System.out.print breaks things because of this
im sure (100%!!!!!!) that if you use System.out.println it would work
but its still reccomended by bukkit to use getLogger().info
👍
Bukkit also complains if you use sysout
I think i've seen someone register their events differently before, and i register mine like this ```
getServer().getPluginManager().registerEvents(new PlayerTeleport(), this);
so, are there more efficient ways to register events?
no
There's registerEvent() but it's older
registerEvents() is really the only means of registering events properly using the API
how big are Plugin objects in memory
And to register commands 🤣
could someone help me figure out why this errors
@Override
public void onDisable() {
Logger.log("Disabling addons: " + Arrays.toString(ADDONS.toArray()));
PluginManager pluginManager = this.getServer().getPluginManager();
ADDONS.forEach(pluginManager::disablePlugin);
ADDONS.clear();
shopManager.clear();
guiManager.clear();
}
i dont think I should be saving a set of plugins right
if (p.getInventory().getItemInMainHand().getItemMeta().getDisplayName() == "charge")
why does this not work
((p.getInventory().getItemInMainHand().getItemMeta().getDisplayName()).equals("charge")?
when implementing tab completions on a given project (public List<String> parseTabCompletions...) and you don't want it to return anything, is there a better way than returning an empty string (return List.of("");)?
If I return null then auto suggests shows the user a player list and the only problem with returning an empty string is you get a very small character, shown here:
Collections.emptyList()
omg that actually works. thanks!
I've been using the empty string method for nearly a year, never even occured to me to use emptyList
i think Collections.emptyList is also more explicit with the name
true
Very important method
Why do people need such things 🤔
new ArrayList<>()
Collections.emptyList()
hmmm
the first one actually allocates a list on the heap (size 10 by default)
second one just returns a staticly constructed list from the collections class, thus no extra heap space
@EventHandler
public void onPlayerBreak(BlockBreakEvent event) {
Player player = event.getPlayer();
if (buildPlayers.contains(player)) {
event.setCancelled(false);
} else if (!buildPlayers.contains(player)) {
event.setCancelled(true);
}
}```
Why can't I break blocks? Im in the buildPlayers ArrayList but I cant break blocks
Doubt this will solve anything but to make it a bit cleaner you can do just event.setCancelled(!buildPlayers.contains(player));
You also don't need the second if statement, you can just use a normal else
did it, thank you 😄
At the moment it look like this:
@EventHandler
public void onPlayerBreak(BlockBreakEvent event) {
Player player = event.getPlayer();
event.setCancelled(!buildPlayers.contains(player));
}```
- use UUID’s instead of player instances
- ArrayList is a bad datastructure for this, use a HashSet
- Don’t set the cancelled state to false (unless this is explicitly what you want)
You want to use a HashSet, not a map
oh
public void onPlayerBreak(BlockBreakEvent event) {
Player player = event.getPlayer();
event.setCancelled(!buildPlayers.contains(player.getUniqueId()));
}```
Should it work now?
I’d just change it to:
if (!buildPlayers.contains(player.getUniqueId())) {
event.setCancelled(true);
}
and yeah should work fine, now just change where you add / remove entries from this hashset
If it doesn't work, you prob didn't register the event lol
did it. Give me 1min, Ill test ist
I did haha
Thats my whole code. If I use /build I still cant break blocks. I registred the event and the command too :c
That is messy
if (args[0].equals("blue")) {}
why does this give me error
Index 0 out of bounds for length 0
it should be
if (args.length == 0) {...}
else if (args.length == 1) {...}
else {
player.sendMessage(...);
}
Can you show how you register the command / event?
args isnt big enough
package de.leleedits.lobbysystem;
import de.leleedits.lobbysystem.commands.AuraCommand;
import de.leleedits.lobbysystem.commands.BuildCommand;
import de.leleedits.lobbysystem.commands.SetSpawnCommand;
import de.leleedits.lobbysystem.listeners.*;
import org.bukkit.Bukkit;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.HashMap;
public class LobbySystem extends JavaPlugin {
public static LobbySystem plugin;
public HashMap<String, String> nick = new HashMap<>();
public void onEnable() {
this.saveDefaultConfig();
plugin = this;
getCommand("setspawn").setExecutor(new SetSpawnCommand());
getCommand("aura").setExecutor(new AuraCommand());
getCommand("build").setExecutor(new BuildCommand());
PluginManager pluginManager = Bukkit.getPluginManager();
//pluginManager.registerEvents(new BreakListener(), this);
pluginManager.registerEvents(new DamageListener(), this);
pluginManager.registerEvents(new HungerListener(), this);
pluginManager.registerEvents(new ItemDropListener(), this);
pluginManager.registerEvents(new JoinListener(), this);
pluginManager.registerEvents(new AuraCommand(), this);
pluginManager.registerEvents(new WeatherListener(), this);
pluginManager.registerEvents(new ChatFilterListener(), this);
pluginManager.registerEvents(new DoubleJumpListener(), this);
pluginManager.registerEvents(new BuildCommand(), this);
}
public static LobbySystem getPlugin() {
return plugin;
}
}
so if theres no args how do I handle that withou erroring
ill change it, 1sek
if (args.length == 0) {...}
You create 2x new BuildCommand
yeah I have that but I want to also have args
[blue, green] -> length == 2
\ \
arg0 arg1
[] -> length == 0
then provide arguments?
I thought I have to register the command and the listener. How can I do it the right way?
if (args.length == 0) {
return false;
}
yes but when I want to check for those arguments it errors
i dont know what to say
if there are no arguments then say "Hey, there's no arguments" and return
Anyways, continue the code
thats this
if (args.length == 0) {
return false;
}
BuildCommand buildCmd = new BuildCommand();
// register command
// register event
I have
if (args.length == 0) {main code /team}
if (args[0] == "blue") {case for /team blue}
if (args[0] == "red") {case for /team red}
else if
👍
lol I did not knew that, thank you!
But I get a error code on my registerEvents
'registerEvents(org.bukkit.event.Listener, org.bukkit.plugin.Plugin)' in 'org.bukkit.plugin.PluginManager' cannot be applied to '(de.leleedits.lobbysystem.commands.BuildCommand)'
yeah ik
what
It needs two arguments ^^
then why are you asking about if else statements
my fault, sorry
I was asking about the error
Ok
still cant break blocks
Shouldn't this work?
I registered it like this:
BuildCommand buildCmd = new BuildCommand();
getCommand("build").setExecutor(new BuildCommand());
pluginManager.registerEvents(new BuildCommand(), this);
ay no, now ur creating 3x instances
you might as well just use Set#remove, there's no reason to check if it contains then remove it
i think thats doing two queries, either way redundant
BuildCommand buildCmd = new BuildCommand();
getCommand("build").setExecutor(buildCmd);
pluginManager.registerEvents(buildCmd, this);
hard to type on mobile lol
Oh, I thought I need to register the event under this, sry
if (args.length == 0) {}
else if (args[0] == "blue") {}
else if (args[0] == "red") {}
compilation error??
why are you doing string comparisons with '=='
getCommand("setspawn").setExecutor(new SetSpawnCommand());
getCommand("aura").setExecutor(new AuraCommand());
getCommand("build").setExecutor(new BuildCommand());
PluginManager pluginManager = Bukkit.getPluginManager();
pluginManager.registerEvents(new DamageListener(), this);
pluginManager.registerEvents(new HungerListener(), this);
pluginManager.registerEvents(new ItemDropListener(), this);
pluginManager.registerEvents(new JoinListener(), this);
pluginManager.registerEvents(new AuraCommand(), this);
pluginManager.registerEvents(new WeatherListener(), this);
pluginManager.registerEvents(new ChatFilterListener(), this);
pluginManager.registerEvents(new DoubleJumpListener(), this);
pluginManager.registerEvents(new BuildCommand(), this);
BuildCommand buildCmd = new BuildCommand();
getCommand("build").setExecutor(buildCmd);
pluginManager.registerEvents(buildCmd, this);```
Is it okay like this?
no
Instance instance = new Instance();
function(instance);
otherFunction(instance);
updated it to .equals()
still compile errors
what errors
Error running 'Plugin [compile]':
getCommand("setspawn").setExecutor(new SetSpawnCommand());
getCommand("aura").setExecutor(new AuraCommand());
PluginManager pluginManager = Bukkit.getPluginManager();
pluginManager.registerEvents(new DamageListener(), this);
pluginManager.registerEvents(new HungerListener(), this);
pluginManager.registerEvents(new ItemDropListener(), this);
pluginManager.registerEvents(new JoinListener(), this);
pluginManager.registerEvents(new AuraCommand(), this);
pluginManager.registerEvents(new WeatherListener(), this);
pluginManager.registerEvents(new ChatFilterListener(), this);
pluginManager.registerEvents(new DoubleJumpListener(), this);
BuildCommand buildCmd = new BuildCommand();
getCommand("build").setExecutor(buildCmd);
pluginManager.registerEvents(buildCmd, this);
Im confused lol
Now it’s ok
Now it works. Thank you very much!
😄
dumb question but how do you switch armor items on a entity
declaration: package: org.bukkit.inventory, interface: EntityEquipment
setHelmet, setChestplate etc.
okay well what went wrong?
it stopped erroring, thx
'@EventHandler' not applicable to constructor
lol
i got it
public void Spawnzom(PlayerInteractEntityEvent e) {
Player p = e.getPlayer();
if (p.getInventory().getItemInMainHand().getType().equals(Material.RED_DYE)) {
if (p.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals("Enhancer")) {
Entity entity = e.getRightClicked();
if (entity instanceof org.bukkit.entity.Zombie) {
Zombie zombie = (Zombie) entity;
}
}
}
}```
why can i not do zombie.getboots()?
it doesnt exist
getEquipment().getBoots()
Any idea about my custom goal issue?
When giving a entity a custom goal that basicially translates to a „go to that location“ thing, it always stops one block before the actual goal
off-by-one error?
The entity pathfinds to the given location correctly
But always stops one block short of the actual block pos given
And I am sure it's not because it‘s like on the edge of the target block, because I made sure to only use block positions
And even made sure the raw xyz is in the middle of a block
I mean integer block coords will be the bottom corner afaik
But if you have a decimal number of some sort I’m not sure
How are you checking if it’s reached the location
Couldn't you just tell it to stop one block closer than you actually want it to
Then it would stop one block out, which is where you want!
When i'm using player.sendMessage() then do I need to put some sort of String in with it?
It gets annoying when I'm trying to do something like this:
// Get all of the players online
for (Player currentPlayer : Bukkit.getServer().getOnlinePlayers())
{
player.sendMessage(currentPlayer + "");
}
C programmer 🤮
Well that's not going to give you much of a nice output
You probably want to print currentPlayer.getName(), but yes it has to be a string
Player#getName
Thanks. Also the code was just an example.
Yes. Unlike System.out.println() which accepts an Object, sendMessage() only accepts a String
cant you just do Bukkit.getOnlinePlayers()
Bukkit.getOnlinePlayers().forEach(currentPlayer -> player.sendMessage(currentPlayer.getName())
i think you can simplify the logic inside the forEach to a method reference
but im too lazy to figure it out rn
i mean bukkit is kinda a mess in general tho
you cant
oh nvm
'Bukkit.broadcastMessage()`
thats for all players
That's what pulse posted
oh yeah i thought we were talking about Ops question
I mean... based on the above text it's still the right answer
Technically that includes console too
So it can get a bit spammy if you are doing it often
Petition to delete Bukkit utility class
the entire class is just useless server wrapper methods
I prefer using Bukkit then getServer()
that is the same thing, yes?
its one more method
remove all of the methods, keep bukkit as a singleton holding more utility methods than just wrapping them for no reason
You can't delete the Bukkit class lol. It's literally what bridges the API to implementation
When I run my command then I get a head, but it doesn't have the meta. Anyone know what's wrong?
// Get head
ItemStack playerHead = new ItemStack(Material.PLAYER_HEAD, 1);
SkullMeta playerHeadMeta = (SkullMeta) playerHead.getItemMeta();
playerHeadMeta.setOwningPlayer(currentPlayer);
playerHeadMeta.setDisplayName(ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + currentPlayer.getName());
// Give the head
player.getInventory().addItem(playerHead);
It's mirroring the methods in Server for convenience
But its one more method
so?
Need to set the item data
Bukkit.getServer().getOnlinePlayers()
Bukkit.getOnlinePlayers()
it saves you 8 more characters
Woopty doo
Bukkit.getServer().getOnlinePlayers();
Bukkit.getServer().isOnline();
Bukkit.getServer().addRecipe(recipe);
Server server = Bukkit.getServer();
server.getOnlinePlayers();
server.isOnline();
server.addRecipe(recipe);
Bukkit.getOnlinePlayers();
Bukkit.isOnline();
Bukkit.addRecipe(recipe);```
of the three, which would you prefer, really?
A redundant call to getServer() every time, an additional variable for no reason, or convenience?
i'd honestly prefer getServer(). more tha nanything
I would never be upset if the api changes to #1
i think conclure at one point was passing two variables in dependency injection. one for his plugin and another for the Server
You save 8 characters
who tf cares about saving characters in java
its a useless class besides holding the server singleton
I do
use kotlin
i dont like how Bukkit stores the server as a singleton
fun main() {
}
public class Main {
public static void main(String[] args) {
}
}
Kotlin is a different language.
its convenient
i wouldnt like having to do Plugin#getServer
But
it would all be linked 🤔
not a bad idea actually
yeah but tbh it doesnt really satisfy the singleton requirement
or well i should say
its one way to solve it i guess
Quick question. Should I have one return true; at the bottom of my command, or should I have a few of them whenever my command ends?
what
missing args
\
return false
case one
\
return true
case two
\
return true
return false // Invalid args
I have another thing that I want to check. When i've been adding colors then I have done ChatColor.RED, but I have seen people do §c. What way is better or does it not matter?
public String colorize(String s) { return ChatColor.translateAlternateColorCodes('&', s); }
// Usage: player.sendMessage(colorize("&6Hello player!"))
how would i get an item object from the getDrops method?
oh, i'm trying to make a mob drop an item thats in a specific location, so would i not be able to do so this way?
What do you mean drop an item in a specific location
so if in location x y z, there is a block, and that is what a specific mob will drop when killed
You can easily spawn your own items in the death event
yes, but i want it to be from a block that can change in a specific spot
So you want to drop the blocks items when a mob dies
pretty much, if it's possible
Just iterate over the drops of the block and spawn them using world.dropItem
Anyone how to make the armorstand (or any entity) face the player, yaw and pitch might do the trick but im can't find a math for it
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
ItemStack clickedItem = new ItemStack(Objects.requireNonNull(event.getCurrentItem()));
ItemStack cursorItem = new ItemStack(Objects.requireNonNull(event.getCursor()));
if (event.getCursor().getType() == Material.ENCHANTED_BOOK) {
if (event.getCurrentItem().getType() != Material.AIR) {
EnchantmentStorageMeta enchMeta = (EnchantmentStorageMeta) cursorItem.getItemMeta();
assert enchMeta != null;
if (enchMeta.hasStoredEnchants()) {
Bukkit.broadcastMessage("Has enchs");
Map<Enchantment, Integer> enchants = enchMeta.getStoredEnchants();
clickedItem.addUnsafeEnchantments(enchants);
event.getWhoClicked().getInventory().addItem(cursorItem);
event.getCursor().setType(Material.AIR);
Bukkit.getScheduler().runTaskLater(mainClass, () -> {
event.getWhoClicked().getInventory().setItem(event.getSlot(), clickedItem);
}, 5L);
} else {
Bukkit.broadcastMessage("No enchs");
}
}
}
}
```So, I have this code which essentially enchants an item that you click on if your cursor is holding an enchanted book, everything works fine except I can't figure out how to remove the item I click, it always goes into my cursor no matter what and I think it's due to the if statements, but idk
I'm very rusty after not having developed in ages, so the solution is prob very easy
I've tried, but doesn't seem to work
Wait
It appears its just a visual glitch :/ (maybe)
So - if I cancel outside of the if statements it works fine, but seems to be visually glitched, cancelling inside the if statements, however, does not work
Which obviously I cannot just cancel every InventoryClickEvent, so that's not a valid solution lol
why are you throwing NPES when the item is null
I only did it so intellij would shut up about it until I add proper checks
What
Are you referring to Objects.requireNonNull(event.getCurrentItem())?
yes
Intellij was bugging me to add that- so I did in the meantime until I can add proper checks
Hello everyone, my name is Minh from Vietnam, can you give me a few youtube channels to guide me to write basic minecraft plugins?
Do you knowJava?
I just learned about it too
Yes or no?
maybe no
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
how do i access the player profile this didn’t work GameProfile playerProfile = ((CraftPlayer) player).getHandle().getProfile(); Field ff = playerProfile.getClass().getDeclaredField("name");
Json may be a good option
what do you mean
you have it
right there
SQLite is also just saved as a flat file
GameProfile playerProfile = ((CraftPlayer) player).getHandle().getProfile();```
im geting error
do you have nms spigot
aka buildtools compiled
or are you using spigot-api
spigot-api dependency for maven doesnt have nms
Learn it lol
oh how do i get build tools
what version of spigot
?bt
You can save it however you want honestly
u dont need to really know a lot of sql for simple data storing
all you need to know is:
DELETE
INSERT INTO
CREATE TABLE
and
UPDATE
How do i get a more specific material from a PlayerDropItemEvent? when i do event.getItemDrop().getItemStack().getType() it gives me something like WOOL or LOG instead of green wool or birch log
I believe so, yml is best for configuration as its not very fast, but if you're only storing a few things and don't have a giant playerbase, should be fine with whatever
why
what version
1.17
update it when a player leaves
when a player joins, if they have data, load into an object
then save it back to sqlite on playerquitevent
if they dont, insert new data and load into an object
No way you are on 1.17
for this use select
wdym.. i am
Or you haven’t put an API version in your plugin.yml
oh
but how would i make it compatible with older versions if it needs an api version?
My question kinda got buried so I'm gonna bump it: #help-development message
event.getClickedItem?
have you tried that
event.getClickedItem().setType(Material.AIR)
i download it do i put it in my plugin dir?
no
Yeah I've tried that, tried cancelling event too, its cause of the if statements but can't thing of another good way to check
ok thx
event.setCurrentItem?
declaration: package: org.bukkit.event.inventory, class: InventoryClickEvent
Yeah, that's what I used. ClickedItem isn't a thing
You can do event.getWhoClicked.setItemOnCursor now
what version
Word? I don't think that'll work either thought because of the if statements but I'll give it a shot
Latest, 1.17.1
how do i make hologram text different per player
Use Packets
yeah how
So here's some debug, I'll post code so you can see what the debug is but basically in the if, it is not seeing the cursor as sword because I haven't ran the event again, and when I try clearing clicked item that doesn't seem to work either
I'm new to spigot
Take a look at wiki.vg and use Protocollib with PacketWrapper
I hope you at least know Java
yeah i do
How can I set multiple lines in MapMarkers or Wapoints in Itemmaps?
InventoryClickEvent problem
I've posted code in thread
geting errors now
show pom
Will cause you some issues
Display name and similar things are sent using the Entity Metadata packet
You can hook into it using ProtocolLib and somewhat read the data
Or just sending a new packet on top
anyone knows how to change player gamemode after they died?
package me.lowjunnhoi.ljhminecraftplugin;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import java.util.concurrent.TimeUnit;
public class Death implements Listener {
@EventHandler
public void onDeath(PlayerDeathEvent event) throws InterruptedException {
Player p = event.getEntity();
p.sendMessage("You died, changing game mode to survival...");
event.getEntity().setGameMode(GameMode.SURVIVAL);
TimeUnit.SECONDS.sleep(10);
event.getEntity().setGameMode(GameMode.SURVIVAL);
p.sendMessage("Your game mode is now set to survival!");
event.getEntity().setGameMode(GameMode.SURVIVAL);
}
}
Why are u setting the gamemode to survival 3 times? Also, you need to use the PlayerRespawnEvent
oh
do it on PlayerRespawnEvent
oops, answered wrong message
wanted to answer this one
also don't use sleep
and if it still doesn't work, do it a tick after the event calls.
@EventHandler
public void onRespawn(PlayerRespawnEvent e){
Player p = e.getPlayer();
Bukkit.getScheduler().runTaskLater(<your plugin-class>, () -> {
p.setGameMode(GameMode.SURVIVAL);
}, 1L);
}
afaik
The bukkit scheduler exist
(wrote from head)
^^^ yes much better code lol
that's the cleanest method afaik
Looks good to me 😛
can't modify it without braces tho, doo dumb for that without an IDE
._.
cool cool cool
no need for braces actually
yea ik
but i can't write lambdas without ide, bc idk how the syntax looks out of my head
guess smt like
Bukkit.getScheduler().runTaskLater(plugin, () -> yourtask(); 50L);
If it takes no args, or the args are the same as the lambda params you can do the
:: thing
ye
oh true
Bukkit
.getScheduler()
.runTaskLater(plugin, () -> player.setGameMode(GameMode.SURVIVAL), 20L);
I don't like the bukkit scheduler that much
looks a bit ugly
sender.sendMessage("Step bro im stuck!");
Will this work? Asking cause im not home and gitHubing from a phone
will work yeah
i'm confused
Nah its for a /stuck command
i'm still confused
he basically wants
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
sender.sendMessage("Step bro I'm stuck!");
return true;
}
For a /stuck command
Or are you confused about lambdas?
why would you do such a command
idk he's stupid
no need to question human stupidity
true
` `` java
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerTeleportEvent;
public class Stuck implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String s, String[] strings){
World world = ( (Player) sender ).getWorld();
if (!( sender instanceof Player )) {
System.out.println("You aren't a player!");
} else
( (Player) sender ).teleport(world.getSpawnLocation());
sender.sendMessage("Step bro im stuck!");
return true;
}
} ```
© 2021 GitHub, Inc.
oh my
Here all code
please
code blocks
Lmao
Meh
Nice code pillow man
😬
what the
Not java but still better than plain
ew
bump
He really added `` on every line
Omfg whats the difference
yourcode
You did way more work and it looks better the other way xD
```java
Literally code here
this
is
the
difference```
`between`
`these`
`two`
^ can be replaced with any language or just left blank
html (:
Bro calm down plz idk how to use discord
I can tell
Uh oh
this is as complex as making a readme file

But
Its basic markup lmao
i explained it
multiple times
but
oh
he doesn't know how to make a readme file
youre copying code on phone?
Paste at top and bottom off ur code
Yeah whats wrong
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerTeleportEvent;
public class Stuck implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String s, String[] strings){
World world = ( (Player) sender ).getWorld();
if (!( sender instanceof Player )) {
System.out.println("You aren't a player!");
} else
( (Player) sender ).teleport(world.getSpawnLocation());
sender.sendMessage("Step bro im stuck!");
return true;
}
}
© 2021 GitHub, Inc. ```
You wc
he made it
Yeah dev on phone sucks
i'm using iphone
never le me write anything on phone
or make sure to wait 5 hours for messages
When u dont use Math.round()
Or String::format (:
Hmm guess String#format also looks fine
imagine you download a 200gb game
your start it
and ingame, it says
game needs to restart for an update
WTF
mw is hillarious
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
/give @RealRivex some food
/op Conclure
uhh, isn't discord allowing only / commands since a few weeks?
Nrly
The bot probably using some kind of text write event
It's been a few months since they've added / commands
still didn't work after trying many ways
package me.lowjunnhoi.ljhminecraftplugin;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitScheduler;
import java.util.concurrent.TimeUnit;
public class Death implements Listener {
@EventHandler
public void onRespawn(PlayerRespawnEvent e) {
Player p = e.getPlayer();
Bukkit.getScheduler().runTaskLater((Plugin) this, () -> p.setGameMode(GameMode.SURVIVAL), 5L);
}
}
the game keeps changing to spectator
Did u setup a broadcast or something to see if its running that code?
?
any one can tell me how would I unregister Enchant
so remove it from map
in Enchants
class
map is static and private
and there is only method to register enchants
Add a broadcast or something to make sure it's actually running that code
what version is that
1.8
dosn't have that method
then you're on your own with that old version
well
it is not the thing
which I was asking
that is to remove enchant of itemstack
I need to unregister enchant
from Enchantment class
I don't believe that's possible, you can only prevent them from getting the enchantment on their item by listening to an enchant event and anvil event
Ring. Ring. Ring
Who this?
This is removeEnchantment!
Nice to meet you, removeEnchantment!
reflection
found the way
it only sends the 1st message test1 but not the second.
package me.lowjunnhoi.ljhminecraftplugin;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitScheduler;
import java.util.concurrent.TimeUnit;
public class Death implements Listener {
@EventHandler
public void onRespawn(PlayerRespawnEvent e) {
Player p = e.getPlayer();
p.sendMessage("test1");
Bukkit.getScheduler().runTaskLater((Plugin) this, () -> p.setGameMode(GameMode.SURVIVAL), 5L);
p.sendMessage("test2");
}
}
that's because you're casting some class to plugin
Is that scheduler not erroring? That's not your main class, right? You shouldn't be able to do (Plugin) this if its not your main
You need to create an instance of your main class and use that instead
how to create commands like /command subcommand?
Well the compiler can’t stop you from casting objects even if the casts are wrong, and since the keyword this is a reserved keyword being a variable that points to the class instance itself it’s technically possible to cast this to anything however it can still be invalid during runtime.
I'm making a plugin where it will show some info about a player in a GUI. When I show the world then I want to use this head:
https://minecraft-heads.com/custom-heads/decoration/2984-globe
How can I get the actual name of the player who owns the head? From looking at the give command then it looks like it has an array or list of different names but when I put them into a skin stealler then nothing happens.
SkullOwner:{Id:[I;-1658131564,-640792186,-1301039191,1645992239]}
If i'm right not every head has a skin
those numbers are part of what makes a UUID
I'm not sure why there are 4 numbers, usually it only requires 2
Most significant bits and least significant bits
does anyone know how Caused by: java.lang.IllegalArgumentException: location.world is caused
im trying to deploy on a cloud server
my guess is that the server's jar is a different version to my plugin's development jar
would like a second opinion so i can fix this faster
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122) ~[spigot-1.17.1.jar:3241-Spigot-6c1c1b2-1492826]
at org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer.teleport(CraftPlayer.java:672) ~[spigot-1.17.1.jar:3241-Spigot-6c1c1b2-1492826]
at org.bukkit.craftbukkit.v1_17_R1.entity.CraftEntity.teleport(CraftEntity.java:493) ~[spigot-1.17.1.jar:3241-Spigot-6c1c1b2-1492826]
at me.marco.Minigames.Objects.Minigame.teleportPlayer(Minigame.java:395) ~[?:?]```
line 395: player.teleport(location);
Most likely your world is not loaded
the weird thing is im on it
so your world arg is null
yeah
i was in the world but it didnt wnat to work
its one of those weird like hosting FTP clients that is being a pain
if your world IS loaded then your world reference is bad/stale
the world was unloaded at some point or replaced
i thought the old spigot jar could be the issue for this
but the bad FTP client could also be the reason for this
FTP client? That has nothing to do with Spigot/Minecraft, nor loading of worlds
u know those bad server hosts that like
make it a pain to upload files/have preset options
im helping someone set something up and i dont have access to the ftp
Still nothing to do with a world being loaded or not
yeah
reuplaoded the world so im guessing its the spigot jar
it works locally but on this server its not
im guessing that the versions just dont like eachother
@eternal oxide is there a way to reference "world"
core.getServer().getWorld("world");
you get a world reference from Bukkit
whats the difference
none
isnt getServer().getWorld() the same
you have to get it when the world is loaded though
if you are unloading/reloading worlds the reference will go stale
is yoru world actually called "world"?
to check what?
the world name
/execute in minecraft:overworld run tp @s -88.11 60.00 -82.79 -127.45 22.33
its in your server.properties
level-name
ah
level-name=world
motd=Powered by AMP```
its not on my local server but its in the external servers properties
is there another way to get the overworld
no
so odd. im guessing its something to do with the world name being changed by the host
could an older/newer jar to the one i compiled with cause an issue like that?
@eternal oxide could an api-version mismatch in the plugin.yml cause that?
thats not going to affect something as simple as getting a world
?paste show the code that is throwing the error
Setting the world: this.world = getInstance().getServer().getWorld("world");
public void teleportPlayer(Location location, Player player){
if(player == null) return;
player.teleport(location);
}
when are you setting this.world?
in the constructor of my Manager class
and when do you create your manager class?
public MinigamesManager(Core core){
this.core = core;
this.world = getInstance().getServer().getWorld("world");
}
at onEnable()
as a test change this.world = to this.world = Bukkit.getWorlds().get(0);
ok ill do it next cycle
i am not being given access to the box so this is a long process...
(thank u for helping 🙂 )
@eternal oxide ive encountered a new issue
at me.marco.Minigames.Minigames.BedWars.BedWars.onDamage(BedWars.java:709) ~[?:?]```
public void onDamage(EntityDamageEvent event){
if (!isGameActive()) return;
if(!(event.getEntity() instanceof Player));
Player player = (Player) event.getEntity();
if(!playerInGame(player)) return;
}
709= Player player = (Player) event.getEntity();
your logic is back to front
I am not checking anything, the pathfinder stops moving the entity by itself once the path is done
if(!(event.getEntity() instanceof Player));
But it always stops one block short of the actual target
also your if does nothing as you terminate the line with ;
its wrong
it shoudl be; if its not a player just return
OH
if(!(event.getEntity() instanceof Player)) return;
oops
yep
sorry
As you can see, the entity always stops exactly one block short of the target
I am confused by the mojang mappings. Has somebody used them yet?
I am, as we speak
Hello, is it okay to use worlds as keys in hashmaps?
Or rather store their names as keys
Anyone aware why this is returning null?
because they are not online
Is there any way to convert an OfflinePlayer to Player without them joining?
I've built literally everything around Player
no
How do I give a skull a custom texture?
depends on your server version really
Does anyone know why I am getting this error while trying to run BuildTools on my jenkins machine? https://paste.helpch.at/ikuqilaboz.sql
I am running the command java -jar BuildTools.jar --rev 1.16.5 and I am using Java 16 to compile.
Not enough information to tell
Here i can provide the full log:
what jar version u on
16 i think
yes 1.17.1
odd, you had one warning in your build [WARNING] The POM for org.spigotmc:minecraft-server:jar:1.16.5-SNAPSHOT is missing, no dependency information available
Can you explain to me what you might use them for? I thought they were supposed to help with not relying on versioned packages but it seems like CraftBukkit is still versioned and you can't use most of the classes without a CraftBukkit conversion it seems (at least those that I would use them for)
Why use mojang mappings at all, other than not having to guess what an obfuscated method does...
because the rest of the ecosystem does
yeah
im not sure how that could happen
I start fresh in a clean directory
kk
can you specify the working directory?
cause my jar is different lcoation from jenkins java execution dir
it will build in whatever directory yoru buildtools jar is in
i dont think thats true actually. I am running the command within Jenkins actually
and it executes within my project directory for jenkins
and not in the same folder as buildtools
oddly
im also running BuildTools as one of my jenkins steps
command arguments
i think
You're right
i saw from some free plugins, and them uses NMS for having multiversion to 1.8 from 1.12.2, do you reccomend me to use them?
How do plugins for multiple versions work? I have seen plugins that support versions from 1.13 up to 1.17.1
They basicially wrap the vanilla server in a way that modifies outgoing packet traffic for the target version of the player
As a side effect, you can only do stuff on parity with the oldest supported version
Some plugins work on most server versions without having to deal with further abstractions and nms since the api kinda provides some version compatibility
for this i do an 1.8-1.12.2 plugin (it's private and i have to do for a bedwars server)
yes i know about blocks but all the PVP players uses 1.8 and mine bw server i probabbly switch from 1.12.2 with viabackwards to 1.8.8 for titles problem
I'm not helping you with that
Let 1.8 die already
Yeah it’s outdated and unsupported
It's not even funny anymore, it's just baggage legacy that prevents the game from being used to its full potential
this
certified 100% right
only reason 1.8 still exists is cuz of the pvp
Would say just the 1.8 fan base
look at my plugin i send
negates that to a good degree
Only reason why it exists is because people are too stubborn to accept that modern software can replicate their beloved pvp perfectly, and that performance is just a matter of proper optimization
?
if it rund 1.8 it rund 1.16 too, if u comfigure kt good enough
fucking keyboard
the resource consumed is too big to handle
no?
slap a 1.17 on a small sized server its gonna choke and die
Correct so it's only there because of the pvp (granted that it takes idiots that dont look for plugins or other ways)
no matter how many optimizations you make
nobody talked about 1.17
That sounds to me like someone hired a incompetent developer
Guys let’s be civil now
well.. youv seen mojangs way
i smell pai n
I managed to get 110 players in a 1.17 server with 12 gb ram (18 tps), just takes a while to optimise it
I can make a proper rpg system with unique mob ai, custom mobs and custom ui using nothing but server sided code and a resource pack, and it still tuns on 20tps on a 2gb server
I don't understand why everyone is crying about performance
let me know when its done and see if its true
If optimised correctly and not made by someone that is new the version does not make that much of a difference
and ur not running on an 512mb ram toaster of some dogshit hoster
true
i hope atleast
xD
It probably helps that I am using my own server implementation instead of something bucket based or vanilla wrapped
The notchian server is terrible
It's a thing I made for my employer
I can't just publish it online
It also runs on C++, so it likely won‘t help you much
I mean still, if you just optimise the shit you make correctly it really does not make that much of an impact
bedrock?
Honestly Java works great
And with J17 giving us the foregin memory api it will become even more powerful
Yes we have unsafe but it’s unsafe, hence the name
Java is awful for a game like Minecraft
would you rather java
or
lua
or some other random useless shit
I agree
Because it gives you proper memory control and resource control
but java is defo not bad
It works, but it's still a terrible choice
there is a reason there are so many java software dev positions
Rewriting the java edition 1:1 in c++ does not improve performance
yeah
but it would allow for optimizations down the line
There are definitely bigger improvements you can make rn to the java edition than to remap it in c++ kek
same thing can be said about projects like sponge
I didn't even look at the java source for it, to not accidentially carry over bad design choices
Like off-threading lighting, but blocking the main thread until it's done
that makes no sense to do async then is it xd
if you’re blocking the main thread anyway
better is to get rid of the definition “main thread” and instead pursue an event-based system which can run stuff in parallel
I've based my server structure on Bungie's job pipeline system
Do you know what a race condition is
Sure but that should just make you alert on the difficulties of concurrent programming, not shove away in a corner bcs its scary 😁
You can't just stuff the event system off-thread and expect it to work
You'd still need to queue up the main operations on the main thread to be applied to the actual game
I never talked about implementations, but I think this is going a bit offtopic now lol
some weird conservative kid in another discord server with an anime profile picture tried flexing that he knew lua
then he made the mistake of saying that he had a token grabber program in lua 😈
hi,
how can i add multiple values to one path in a yamlconfiguration?
using a List<Object> should probably do the trick
ohhh... okay. thanks
LMFAO
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Hey, i wanna make a method what allows me to store nbt on a block of a specific type of a schematic assigned to it so when I place it on the ground i can get the type assigned to it and then I can run a command to reverse the action. Any advice how to do so?
me you melon
💅
What are the differences between AsyncPlayerChatEvent and PlayerChatEvent?
AsyncPlayerChatEvent might be fired asynchronously
PlayerChatEvent should always be fired on the server thread.
What is better to use?
Probably the async one since iirc the normal one is deprecated
It is
Okay
Generally they're always going to be async also, they're only not async if you force them to talk
Atleast that's what the docs say 
Lol
Unless you run the method async 😉