#development
1 messages Ā· Page 137 of 1
maybe dead penalties
add percentage on dead penalties or slowly dying effect
Imagine making a smoking server
smoke-yellow stained wool
Flexing rank jess
Jess..ie
Jessie, we need to cook

: Mr white... my gif is not embedding
: NO JESSE, you need to have TIER FOUR to post embeds
: But MR WHITE HOW DO I GET SO MUCH EXP
: YOUR GITHUB JESSE, YOU NEED TO LINK YOUR GODDAMN GITHUB
lmao
I'm stealing those
Thanks for that emily you have fixed my whole problem witht that small bit of code š
Lmao. That's funny. I laughed
lol
Hello so im a bit stumped im trying too update my table in a database and i cant figure why it doesnt actually update ``` public void update(Player player)
{
try (Connection connection = coreDatabase.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE Spawn SET X=? AND Y=? AND Z=? AND YAW=? AND PITCH=? AND WorldName=? AND PlayerName=? AND PlayerUUID=? AND Server=? WHERE WorldName=? AND Server=?"))
{
preparedStatement.setDouble(1, player.getLocation().getX());
preparedStatement.setDouble(2, player.getLocation().getY());
preparedStatement.setDouble(3, player.getLocation().getZ());
preparedStatement.setFloat(4, player.getLocation().getYaw());
preparedStatement.setFloat(5, player.getLocation().getPitch());
preparedStatement.setString(6, Objects.requireNonNull(player.getLocation().getWorld()).getName());
preparedStatement.setString(7, player.getDisplayName());
preparedStatement.setString(8, player.getUniqueId().toString());
preparedStatement.setString(9, coreConfig.getConfig().getString("Internal.Name"));
preparedStatement.setString(10, Objects.requireNonNull(player.getLocation().getWorld()).getName());
preparedStatement.setString(11, coreConfig.getConfig().getString("Internal.Name"));
preparedStatement.executeUpdate();
}
catch (SQLException e)
{
cmf.header(MessageType.WARN);
Bukkit.getLogger().log(Level.FINE, cm.Colour("&2Table -> Core"));
Bukkit.getConsoleSender().sendMessage(cm.Colour("&4Failed to Set Spawn Point!!!"));
e.printStackTrace();
cmf.footer();
}
}```
Thats the whole update section
is there only one row in that database?
you'd want to do UPDATE Spawn SET <blah> WHERE id=? to make sure you're editing the right row
Yh thereās only 1 row atm
I think that Server = ? for the SET statement is not going to do anything. Because you already have a filter for the value of that column and both use the same value ("internal.name")
view.setProperty(InventoryView.Property.TICKS_FOR_CURRENT_FUEL, FurnaceGUI.this.totalBurnTime);
view.setProperty(InventoryView.Property.TICKS_FOR_CURRENT_SMELTING, 200);
view.setProperty(InventoryView.Property.BURN_TIME, FurnaceGUI.this.burnTime);
view.setProperty(InventoryView.Property.COOK_TIME, FurnaceGUI.this.cookProgress);
Why is this throwing an index out of bounds exception?
java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 0
at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) ~[?:?]
at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) ~[?:?]
at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266) ~[?:?]
at java.util.Objects.checkIndex(Objects.java:359) ~[?:?]
at java.util.ArrayList.get(ArrayList.java:427) ~[?:?]
at net.minecraft.world.inventory.AbstractContainerMenu.setData(AbstractContainerMenu.java:744) ~[?:?]
at org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer.setWindowProperty(CraftPlayer.java:1828) ~[paper-1.18.1.jar:git-Paper-121]
at org.bukkit.inventory.InventoryView.setProperty(InventoryView.java:446) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at com.olziedev.virtualfurnace.furnace.FurnaceGUI$1.run(FurnaceGUI.java:86) ~[VirtualFurnace 1.0.0.jar:?]
at org.bukkit.craftbukkit.v1_18_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.18.1.jar:git-Paper-121]
at org.bukkit.craftbukkit.v1_18_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[paper-1.18.1.jar:git-Paper-121]
at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[paper-1.18.1.jar:git-Paper-121]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?
i suggest you using commas in sql statements instead of "AND"
UPDATE Spawn SET X=?, Y=?, Z=?, YAW=?, PITCH=?, WorldName=?, PlayerName=?, PlayerUUID=? WHERE WorldName=? AND Server=?```
Also removed the update column for server
Hi there, I've got an entity damage by entitiy event.
However it keeps getting triggered even though 0 damage is taken:
private static HashMap<Player, Long> inCombatTimer = new HashMap<>();
private static final int MILLISECONDS_PER_SECOND = 1000;
public CombatLog(Main main) {
this.main = main;
}
@EventHandler(ignoreCancelled=true)
public static void onPlayerAttackEvent(EntityDamageByEntityEvent e) {
if (!e.isCancelled()) {
if (e.getDamager() instanceof Player && e.getEntity() instanceof Player) {
if (e.getDamage() > 0) {
Player p = (Player) e.getDamager();
Player target = (Player) e.getEntity();
if (inCombatTimer.get(p) != null) {
inCombatTimer.remove(p);
inCombatTimer.put(p, System.currentTimeMillis());
inCombatTimer.remove(target);
inCombatTimer.put(target, System.currentTimeMillis());
} else {
inCombatTimer.put(p, System.currentTimeMillis());
inCombatTimer.put(target, System.currentTimeMillis());
String combatMessage = Main.protoTypeMessage + ChatColor.GRAY + "Je bent nu in combat! Je mag "
+ ChatColor.DARK_RED + ChatColor.BOLD + "NIET" + ChatColor.GRAY + " uitloggen. ";
p.sendMessage(combatMessage);
target.sendMessage(combatMessage);
}
}
}
}
}
Does anyone know what's wrong?
did anyones mc server just commit death yesterday?
name: Spell Casting
version: 1.0
author: MrSkullis
main: me.mrskullis.spellcasting.Main
description: 3 Sequence LRL spell casting test plugin```
package me.mrskullis.spellcasting;
import org.bukkit.plugin.java.JavaPlugin;
import me.mrskullis.spellcasting.listeners.click.WandListener;
public class Main extends JavaPlugin
{
@Override
public void onEnable() {
new WandListener(this);
}
}
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
⢠HelpChat Paste - How To Use
You didn't explain the problem tho
Could you post the start up log
1 sec
error could not load plugins spellcasting.jar in folder plugins
invalid description exception
20.05 15:39:06 [Server] ERROR Could not load 'plugins/SpellCasting.jar' in folder 'plugins'
20.05 15:39:06 [Server] INFO org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
20.05 15:39:06 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:150) ~[patched_1.12.2.jar:git-Paper-1618]
20.05 15:39:06 [Server] INFO at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:136) ~[patched_1.12.2.jar:git-Paper-1618]
20.05 15:39:06 [Server] INFO at org.bukkit.craftbukkit.v1_12_R1.CraftServer.loadPlugins(CraftServer.java:318) ~[patched_1.12.2.jar:git-Paper-1618]
20.05 15:39:06 [Server] INFO at org.bukkit.craftbukkit.v1_12_R1.CraftServer.reload(CraftServer.java:806) ~[patched_1.12.2.jar:git-Paper-1618]
20.05 15:39:06 [Server] INFO at org.bukkit.Bukkit.reload(Bukkit.java:559) ~[patched_1.12.2.jar:git-Paper-1618]
20.05 15:39:06 [Server] INFO at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:55) ~[patched_1.12.2.jar:git-Paper-1618]
20.05 15:39:06 [Server] INFO at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:152) ~[patched_1.12.2.jar:git-Paper-1618]
20.05 15:39:06 [Server] INFO at org.bukkit.craftbukkit.v1_12_R1.CraftServer.dispatchCommand(CraftServer.java:685) ~[patched_1.12.2.jar:git-Paper-1618]
20.05 15:39:06 [Server] INFO at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1297) ~[patched_1.12.2.jar:git-Paper-1618]
20.05 15:39:06 [Server] INFO at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:45) ~[patched_1.12.2.jar:git-Paper-1618]
20.05 15:39:06 [Server] INFO at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:5) ~[patched_1.12.2.jar:git-Paper-1618]
20.05 15:39:06 [Server] INFO at net.minecraft.server.v1_12_R1.PlayerConnectionUtils.lambda$ensureMainThread$0(PlayerConnectionUtils.java:14) ~[patched_1.12.2.jar:git-Paper-1618]
20.05 15:39:06 [Server] INFO at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_312]
20.05 15:39:06 [Server] INFO at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_312]
20.05 15:39:06 [Server] INFO at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46) ~[patched_1.12.2.jar:git-Paper-1618]
20.05 15:39:06 [Server] INFO at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:850) ~[patched_1.12.2.jar:git-Paper-1618]
20.05 15:39:06 [Server] INFO at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:423) ~[patched_1.12.2.jar:git-Paper-1618]
20.05 15:39:06 [Server] INFO at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:774) ~[patched_1.12.2.jar:git-Paper-1618]
20.05 15:39:06 [Server] INFO at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:666) ~[patched_1.12.2.jar:git-Paper-1618]
20.05 15:39:06 [Server] INFO at java.lang.Thread.run(Thread.java:748) [?:1.8.0_312]
20.05 15:39:06 [Server] INFO Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
ooooh
I think its bc my yml is in a package?
would that do it?
yup that was it *sigh*
ur plugin.yml has to be in resources
Does anyone know how to lock a players inventory, but a specific slot, make sure they can't drop an item, move it with hotkeys, and make sure they can't change with their off hand
you can do that with the inventory related event listeners
detect and then cancel all the actions you don't want the player perforning
Anyone worked with PlayerItemDamageEvent and had it firing twice? I have one event listener with a log at the top, and when i swing a sword and it takes damage, it logs twice 
What would be a proper way to disable elytra riptide boost? I tried to listen to PlayerRiptideEvent and then set Player#setGliding(false) but that doesn't really work =/
that's visual only afaik
that bit flag
the one time I wanted to prevent elytra + riptide I think I did something with the velocities
hold on
well we didn't want to remove the enchantment entirely
like it was fine without an elytra
or remove it temporarily if player is in water/it's raining and when the player uses the trident and then re-add it shortly after
5Head
too many potential points of failure
items are moved and dropped
they're cloned all the time
lol
Aren't player events cancelleable?
does that work?
public abstract class PlayerEvent
extends Event```
PlayerEvent has 49 sub classes, 1 fields, 2 methods, and 1 extensions.
Represents a player related event
I'm having a problem with saving data in config files.
On my localhost server everything saves perfectly fine, but on the actual server (PebbleHost) whenever the server stops it doesnt save any data and the yml file is empty.
Is there a known problem with pebble or am I doing something wrong?
Showing your code would be helpful
?paste
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
⢠HelpChat Paste - How To Use
https://paste.helpch.at/awuhixuxup.cs I'm aware theres some redundancy for the but it works perfectly on my test server.
Heres my code
riptide is client sided
and the event is unreliable anyway thanks to some mistakes in netcode
Removing the enchantment is the only 100% reliable way
Hi! I'm very new to spigot development. I'm making a plugin and would like to be able to use some data as placeholders. Do I need to create a separate project for the expansion and if so then how can I access my plugin's class from within the expansion?
creating a separate project is an option but you can also do it within your plugin
https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Hook-into-PlaceholderAPI#first-steps
https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/PlaceholderExpansion#with-a-plugin-internal-class
You can do both, create an expansion as a separate .jar file or make it inside the plugin (which i personally rather doing). You pass a reference (of your main class) in the constructor or you access using static (well, in case you don't know what constructors are)
QUESTION: Havin in my class
private NamespaceKey key;
```it is ofc null, will it throw error if plugin is installed on older versions than 1.12??
**SOLVED:** Doesn't throw errors xdd (Confirmed)
**EDIT:** nvm, doesn't throw error but doesn't register listeners xd
purpur has deprecated ItemMeta#setDisplayName method, you think it will be removed soon from purpur? (Just wondering)
Thanks a lot of for the pointers!
I'm getting an error
Cannot invoke "me.clip.placeholderapi.PlaceholderAPIPlugin.getLocalExpansionManager()" because the return value of "me.clip.placeholderapi.expansion.PlaceholderExpansion.getPlaceholderAPI()" is null
which leads to https://www.spigotmc.org/threads/placeholder-api-error.550815/, but OP wasn't nice enough to share the solution
any ideas?
i'm using java 17 and 1.18 Paper (also Java 17 server)
And I have it as
depend: [ PlaceholderAPI ]
softdepend: [ EssentialsX, PlaceholderAPI ]
the bug report template tells me not to report issues with expansions and to use the appropriate issue tracker for those. any idea where that may be?
it appears i'm "shading" placehodler api classes (which I do not understand what it means). I'm using maven, any way to fix this?
I set it as "provided" in pom.xml and that works (got Successfully registered expansion) but I can't get any of the placeholders to work
my code is
@Override
public String onRequest(OfflinePlayer p, String identifier) {
if (identifier.equals("test")) {
return "works";
}
return "doesn't work";
}
using /papi parse nothing gets replaced
and what's the placeholder you're parsing
set the expansion name as testing
and parsing
%testing_test%
and what are you getting back?
i'm very new to plugin development so I might be missing something obvious
same thing %testing_test%
Did you register the expansion?
i did, it even says Successfully registered expansion with its name and version
im using public String onRequest(OfflinePlayer p, String identifier)
Can you try changing the method to onPlaceholderRequest or whatever the other one is called
sure
Haven't messed with papi in quite a while so not 100% sure
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
⢠HelpChat Paste - How To Use
Can you try overriding canRegister as well, and set it to true
Could be plugman fucking with it
Is it possible to use custom model data for blocks too or only for items?? I would like to create like new blocks with different textures
i tried a full restart but it didnt work in the past
i'll try one rn as well
yeah same thing, no difference
what i've seen people do is create invisble item frames and put them on blocks. then put your custom modeled item in the itemframe. afaik blocks lose nbt data when placed
No clue then
You can do what William said or use a plugin like customblocks or oraxen which use noteblocks for custom blocks
Note blocks have 800 blockstates so thereās like 799 custom blocks you can make with them
I bought oraxen but I wanted to create all by myself except for modelengine, that was too much work hahahahah
For what I need to do 799 blocks arent enought hahahha
So i think Ill try another way
Like the itemframes one
Do you have reference? I dont clearly understand: you mean an invisible block like a barrier with an itemframe that displays a block inside that barrier?
any block you want (if you want it to be transparent use a barrier), then put an invisible item frame on it (using custom model in your texture pack)
this is what i've seen being done for decoration
but you mean on each face of the block a itemframe?
I know what you mean ohhh
You mean like for a wall thing, but for actual 3d blocks?
Yeah that would still work
Itemframe in barrier with a big block model inside the itemframe
Like this? I see that thing on servers I dont understand how:
From this: https://gyazo.com/0c2a80802d6b7d50122cd3baa608a6dc
To this: https://gyazo.com/f55cf9dec2087d4fbfc0230822fed051
I dont understand what's that thing inside with a glow effect
Thatās a button on an armorstand
With custommodeldata to show the crate model to people with the pack
Id use item frames if youāre on 1.16+
You canāt make them invisible on older clients
Why not update to 1.18.2?
I was on 1.18.2 I had an issue I thought it was for that .2 so i downgraded and never upgraded
Event to cancel entity transform in 1.8.8? zombie -> pib zombie creeper -> charged creeper
EntityTransformEvent doesnt exist tehre
1.8.8 
Found it: CreatureSpawnEvent
i think so
question is
i want to strike a lightning to players/entities
but i want to cancel transformation into other mobs but just from those lightnings (not natural lightnings)
best way to do it?
maybe try cancelling the damage event?
I'm not sure how it detects when to transform entities in 1.8.8
uhhh let me look
what about entitydamagebyentity
check that damage cause is lightning and cast the damager
That's a good idea too
only LightningStrikeEvent but that doesn't have a noDamage moethod or sth xd
already doing that, but how to detect if the lighting is a custom summoned lightning
There's a LIGHTNING damage cause
You can check that in a damage event listener and see if its a zombie/creeper, then cancel it
āļø
Oh I missed that lmao
i know how to cancel things, issue is to get if that was summoned by the entity
or natural
maybe metadata
Yeah was gonna say
Add metadata to your lightning as you summon it then check that
it prob already called the damage event

I am making a class plugin, and I wanted to know how I can make certain potioneffects when choosing a class
pick class, add potion effects
LightningStrikeEvent has a #getCause
i tried this
as mentioned
pick class, add potion effects
if you want, a task
and add potion effect every 3 seconds with a duration of 4 secs
so if they remove the class, they lose the effects
or even 1 second timer with a 1.5 or 2 secs effect duration
i dont get
the issue tbh
fk
@EventHandler
public void onPlayerJoin(PlayerJoinEvent e) {
Player player = e.getPlayer();
if (plugin.storageConfig.contains(String.valueOf(player.getUniqueId()))) {
for (String key : plugin.guiConfig.getConfigurationSection("items").getKeys(false)) {
List<String> effects = plugin.classesConfig.getStringList(key + ".effects");
for (String effect : effects) {
player.addPotionEffect(new PotionEffect(PotionEffectType.getByName(effect), 86000, 1, true, true));
}
}
return;
}
player.openInventory(selectorGui.getInventory());
}```
i tried that
and the exact issue is?
Try debugging it!
What does your effects key have in the config? Maybe your names are wrong
first, the issue, what is it
what doesnt work
does not give the potion, does nothing
š¤·āāļø could be
we need to know the exact issue
its registered
100% sure?
are you sure its working
it's called 100%?
the issue is does not give the potion
yep
yep
okay well are you sure your storageConfig file has your uuid in it?
yes
Yeah try adding debug lines after each check to see what's going on
its a pretty trivial method but it should work. Something like just 1,2,3,4 etc after each check should tell you where your thing is choking
nvm, won't work, the lighting still needs to hit the entities
What won't work?
it just should not convert them, so creature spawn is needed
uhhhh can you add metadata to the entity you striked?
actually no that's a bad idea lmao
@EventHandler
public void onPlayerJoin(PlayerJoinEvent e) {
Player player = e.getPlayer();
if (plugin.storageConfig.contains(String.valueOf(player.getUniqueId()))) {
player.sendMessage("POINT #1"); /* WORKS */
for (String key : plugin.guiConfig.getConfigurationSection("items").getKeys(false)) {
player.sendMessage("POINT #2"); /* WORKS */
List<String> effects = plugin.classesConfig.getStringList(key + ".effects");
for (String effect : effects) {
player.sendMessage("POINT #3"); /* DONT WORKS! */
player.addPotionEffect(new PotionEffect(PotionEffectType.getByName(effect), 86000, 1, true, true));
}
}
return;
}
player.openInventory(selectorGui.getInventory());
}
in "for (String effect : effects) {" stop works
Yeah yeah, then just remove the metadata key a tick or two later
i can simply add a long with strike time
does that require nms in 1.8?
and listen to spawn event and if more than 1 secs passed, then the lightning was not summoned by me
no xd
too many tasks i think
fair
show config
be fast
storage
f383e2c1-eb6a-4321-b786-4076c826821f:
selected-class: warrior
that one works already, send the classes one
stroke is the past of strike right?
classes
Warrior:
effects:
- '[ABSORPTION]'
- '[INCREASE_DAMAGE]'
no its struck
fair
remove your []? š
and lowercase your Warrior class so its 'warrior'
haha
will this generate a lot of lag? it is assumed that as long as it is connected it will have the potion
thanks
shouldn't
No, just make one task that handles it
since you add effects, i guess must be sync
not async, so cant tell
most do that so i dont think there is an issue
It really shouldn't be that big of a deal
one task only? i rather making more tasks
than one task that loops thru players
checking class and loads effects from config
just my tho
Yeah I mean if he wanted to he can split it up lol
idea's the same though it shouldn't be too bad
Since its running every 3 seconds. The server does tons more than that every tick
so its pretty negligible in the grand scheme of things
Bukkit.getScheduler().runTaskTimer(plugin, new Runnable() {
@Override
public void run() {
player.addPotionEffect(new PotionEffect(PotionEffectType.getByName(effect), 30, 1, true, true));
}
}, 20, 30);```
this works?
You can probably step up the timer higher tbh
i changed the duration of the potion to 35
but yea it should work fine
and works c:
yeah was gonna say you should put some leeway there so that its not too choppy
theres now an api for it i believe
in the spigotapi
or atleast last time i checked it exists
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("This message will be in the Action Bar"));
that?
ugh. its been for a while?
yeah
oh okay
naa, just some years
the only one that doesnt have a native method is 1.8.8 xd
thats the only way actually
as listening to command pre process event doesnt create the command so other plugins cant execute it as player
Why not use Player#removePotionEffect or whatever it is?
server crash, plugin disable + allow other plugins to add better or longer potion effects
but ofc, thats just my tho
I was just wondering, that makes sense

I try shade a api but it refuse. Try several things, it is Item-NBT-API I try to shade.
https://pastebin.com/yiFfRQV7
Seams it not even find it (is no issue access the methods but can“t shade it).
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
I barely know how to use maven and you say I should use gradle?
I not even understand how to set up gradle. is even more confusing how to set up dependency and shade.
Ā» Give the helpers some details
Ā» Ask suitable questions
Ā» Be polite
Ā» Wait
wait wrong one
yes
I'm having the weirdest issue ever where InventoryClickEvent doesn't get fired sometimes.
Trying to make a GUI that players can take items from, but not add. Most of the time, this works fine, but sometimes it lets me put items back in, and it seems like the InventoryClickEvent just doesn't fire
As you can see, sometimes it lets me put the slot in, and my inv click event seemingly doesn't fire at all. Any ideas / solutions?
code isn't too important, but i have added prints to the listener and they don't print sometimes, making me think the listener doesnt get hit
1.16.5 for what it's worth
Have you check InventoryDragEvent?
If you add item at same time you move cursor that event get trigged.
HELP CHAT
will have a look and see if it fires
dont scream pls
Trust me on that , I get same issue as you have. And the problem was that event
how i can pass a string from constructor to other class?
oh my god i think you're right
that makes no sense but
ty
but spigot*
Exactly my my thought about this also.
?di
Dependency Injection
Dependency Injection is a way of providing objects with the objects they need ("dependencies"). This is usually done with a constructor, but can also be done for individual methods
Read more here: https://en.m.wikipedia.org/wiki/Dependency_injection
Dependency Injection in Java:
https://paste.helpch.at/yijawupoju.java
Dependency Injection in Kotlin:
https://paste.helpch.at/esogakutod.kt
Is not only broken event, look on InventoryMoveEvent and cry XD if you want an idea what is wrong, so modify that even the inventory content also (So need delay the check of inventory content with 1 tick).
š
it seems to be working now so i think we're good
but yeah spigot inventory stuff is such a mess
yes, it need heavy cleanup š
just use triumph-gui. ez :)))
i was originally
same issue lol
but i also realised that i didnt need a full framework for what's a glorified chest
@EventHandler
public void onInventoryClick(final InventoryClickEvent e) {
final Player player = (Player) e.getWhoClicked();
player.sendMessage("CHECK #1");
if (!e.getInventory().equals(classCreatorGui.getInventory())) return;
player.sendMessage("CHECK #2");
e.setCancelled(true);```
the check #2 dont works, why?
Is good properly but missing stuff.
ugh. what?
if (!e.getInventory().equals(classCreatorGui.getInventory())) return;
you're checking that those 2 inventories are not the same. the CHECK #2 will only show if they're exactly the same inventories
it's supposed to be the same inventory
well I mean, I guess show the getInventory method and where you open the inventory
To be real the client and just window click packets are just raw no matter what
One time to be a lil lenient with spigot
no mercy
someone needs to take the blame
Or at least it should be documented better
Like peep the code for the window click
Shit is actually
Mind fucked
And suicide
I don't want to
try gradle, but is even worse how to set it up. Only get it print errors https://pastebin.com/ptv8m0yt
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
send your build file
alright, can already warn for it probably upside down or worse.
add this under id 'java' and remove buildscript { }
id 'com.github.johnrengelman.shadow' version '6.1.0'
I solve the issue in maven. I needed to do com.github.broken1arrow.Item-NBT-API:* instead of only have com.github.broken1arrow:* . apparently change the path when fork it (miss that change).
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
HOW TO enable flying?? MINECRAFT PAPER
java: error reading C:\Users\PCNASA.m2\repository\org\apache\logging\log4j\log4j-api\2.17.1\log4j-api-2.17.1.jar; error in opening zip file

try updating it from maven central?
Try deleting the file and rebuilding it?
will it fix that? xd
have you done mvn clean install to reinstall the files?

tell me, seriously or just guessin xd

Why if I do on a scoreboard - sidebarScore name = obj.getScore(player.getName()); name.setScore(3); I get also his team prefix (Lvl10) before his name instead of only the name which is RoyalDestiny? https://cdn.discordapp.com/attachments/708049443588407367/977885591251337266/unknown.png
thanks
How can I center text on a items lore?
I tried to create my own class but that was super wonky, most text was too far left or too far right.
Use your space key
I want something that doesnt use a ton of my time manually centering
You can use StringUtils#center from the included apache commons lang
is it possible to allow creeper explosions in a WG region
but deny the block damage (i mean so blocks are not destroyed)
d;spigot EntityExplodeEvenet#setYield
public void setYield(float yield)```
Sets the percentage of blocks to drop from this explosion
yield - The new yield percentage
@shell moon
oh so you want only specific blocks
should have asked in #general-plugins
was playing around with WG
oh
yes i am
but my creepers still didnt explode
but damaged players
it was WG config
well you can use blockList() and manually explode the ones or if it's mutable then just remove the worldguard ones
what options?
like is that a config option in your plugin?
show code then
are you cancelling the event?
how can I cancel all async tasks my plugin is executing when I shut down the server?
to avoid this
that's not the point. I have an async timer task that runs every lets say 20s, and if it's running, the server will spam that error
Cant you cancel them in onDisable?
Cancel the timer on disable
there's a cancelAllTasks method I believe
Call the guards on them
you can just do BukkitScheduler.getPendingTasks().forEach (BukkitTask::cancel);
or something
okay thanks
also, just to make sure I understand this, this error happens because the chunk isn't loaded? https://paste.helpch.at/umosunutut.cs
Bump
Please help me out :)
how do you know 0 damage is being taken?
well, they're in a team, external plugin which if I hit the person he takes no damage
and I checked the damage by doing a e.getDamage <= 0
sounds like your plugin is receiving the event before that other plugin cancels it. you can try adding priority = EventPriority.MONITOR to your EventHandler annotation
So i am using this in my code (jdk 18) byte[] bytes = Base64.decode(base64); with import import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;
but when building it gives me this: error: package com.sun.org.apache.xerces.internal.impl.dv.util does not exist import com.sun.org.apache.xerces.internal.impl.dv.util.Base64; anyone that could help?
Use java.util.Base64
Are blockstates like custom model data so you can choose to give different textures by choise or the variants array is always random?
How do I make sure that a world is loaded? When I reload my plugin I can spawn a zombie with a command, but on server start it says world is null
if (Bukkit.getWorld(name) == null) new WorldCreator(name).createWorld();
that is from memory but I believe that js correct
I dont wanna make a world
How could i go about putting Item Meta into a Database
Bukkit.getWorld(name) != nullI guess
Base64 serialization is an option
okay
it will load it, as long as it has been created before
public void onClick(InventoryClickEvent event)
{
Player player = (Player) event.getWhoClicked();
InventoryView view = event.getView();
if (view.getTitle().equals("dikke aids"))
switch(event.getCurrentItem().getType()) {
case APPLE:
public void run() {
this.time--;
if (this.time == -1) {
this.time = 9;
this.seconds--;
}
if (this.seconds != -1) {
player.sendTitle("kanker", this.seconds + "." + this.time + "s", 0, 60, 0);
player.sendMessage("debug1");
}
if (this.seconds == 0 && this.time == 0) {
player.sendTitle("test", this.time + "s", 0, 60, 0);
player.sendMessage("debug2");
}
event.setCancelled(true);
return;
}
}
}
}``` Intellij displays an error at the public void run**()** anyone that knows the solution?
the error is shown on the () after run
You're missing a bit on that
what do I miss?
Well I presume what you want to have there is a runnable, so create a new bukkit runnable
with your method inside it
I'm very stupid š Thanks for your help.
any ideas why I might be getting this error? https://paste.helpch.at/ojuxitiqoh.rb
Line 60 of DropManager.java: var allGens = new HashMap<>(cache.getGenerators().getLocations());
just do https://paste.mufin.live/XM8Qu
probably might want to share the whole class or at least the method. idk
but anyways, concurrent modification. You're creating the new map from another map while probably looping thru that map
yeah. probably since you run it async, you end up modifying the map in another thread.
Idk what the best solution here is, but there's ConcurrentHashMap. That's something you could use instead of a HashMap
Would that prevent the issue? Also, what's exactly the difference?
CHM is thread safe
using CHM to fix this particular issue is a bit of a crutch
@worn jasper show the source for getLocations
or die
actually that might just be a classic CME lol
nothing to do with modifying while iterating
so yeah you need to be careful when you're modifying stuff async
ConcurrentHashMap will help to a degree but thread safety is a messy thing
How do i cancel a Bukkit Task when a player moves when they issue /spawn ive attempted too cancel it with this ```
@EventHandler
public void onMove(PlayerMoveEvent e)
{
spawnCommand.getSpawnCountDown().cancel();
cmf.header(e.getPlayer(), MessageType.ERROR);
e.getPlayer().sendMessage(cm.Colour("&cSpawn Teleportation Cancelled due to Movement!!"));
cmf.footer(e.getPlayer());
}```
and then pulls this https://paste.helpch.at/ilokayaqoc.sql
aka how can i check too se if its running to then cancel it
Your getSpawnCountdown() task is null
You can use a null check then
so ive currently got his code but it doesnt cancel the task and just continues on
Heres the Event class : https://paste.helpch.at/awodorupof.java
Command Class: https://paste.helpch.at/ikugomehex.java
can decrease performance/cause other unexpected problems
thread safe hash maps only allow one operation to go on at a time, so if 2 threads try to do something at the same time, it will do one, wait for it to complete, then let the other thread access it
depends on your use case tbh
well that's not strictly true but it depends on the impl
private val gson = GsonBuilder()
.setPrettyPrinting()
.disableHtmlEscaping()
.registerTypeAdapter(Component::class.java, ComponentSerializer())
.registerTypeAdapter(Voucher::class.java, VoucherSerializer())
.registerTypeAdapter(Pattern::class.java, PatternSerializer())
// Messages
.registerTypeAdapter(TitleMessage::class.java, TitleMessage.TitleMessageSerializer.INSTANCE)
.create()```
```kt
internal class ComponentSerializer : JsonSerializer<Component> {
override fun serialize(src: Component?, typeOfSrc: Type?, context: JsonSerializationContext?): JsonElement {
return if (src == null) JsonNull.INSTANCE else JsonPrimitive(MiniMessage.miniMessage().serialize(src))
}
}```
So I got a gson instance, each type adapter is a `JsonSerializer<>` class. Is possible to somehow have access to this gson instance when serializing objects? For instance, TitleMessage has components, and I made it so components are serialized using MiniMessage, but the available `JsonSerializationContext` acts like a standard gson instance, with no type adapters, or at least not the ones I registered.
get gud?
smh frosty
{
System.out.println(w.getName());
for(Entity entity : w.getEntities())
{
System.out.println(entity.getName());
}
}``` Why it doesnt get the entities in the worlds? that's strange, I disabled natural spawning with gamerule but if I spawn them with eggs and I see them when logging back why shouldn't it count those
because it does not load the whole world obviously
i just found out online after one hour it was a common world corruption in level.dat, level.dat_old and stats file so I just had to delete those.
How should I count how many people are within a radius of a block?
@limber hedge use this and filter by entity type, if you want a circle area
d;spigot World#getNearbyEntities
@NotNull
Collection<Entity> getNearbyEntities(@NotNull Location location, double x, double y, double z, @Nullable Predicate filter)```
Returns a list of entities within a bounding box centered around a Location.
This may not consider entities in currently unloaded chunks. Some implementations may impose artificial restrictions on the size of the search bounding box.
location - The center of the bounding box
x - 1/2 the size of the box along x axis
y - 1/2 the size of the box along y axis
z - 1/2 the size of the box along z axis
filter - only entities that fulfill this predicate are considered, or null to consider all entities
the collection of entities near location. This will always be a non-null collection.
Or the second method with BoundingBox for a rectangle
bump
How could I get if there is no mob in a certain location and use it with an if statement?
can someone who is good with this plugin pls help me with making something im a owner on a network and im trying to add a gui but it is very advanced and im not sure if its worth making a custom plugin for it
pls dm me
Don't need to ask in multiple channels. And why DM just ask your question and provide details.
[service] Custom GUI using DeluxeMenu
[Request] I something like hypixel smp were if u are a vip or abouth then you can create a world using multiverse but i need it so that you can also manage the players smp with like gamerules and stuff
Just use the playername variable (placeholder)
Hi, i have a question about MySQL NodeJS and JSON
Currently the result is { user: 298113936840982500, product: 'mtdrugs', ip: '0' }
Code:
``` connection.query('SELECT user, product, ip FROM aankopen WHERE user = ' + req.user.id + ';', function (error, results) {
if (error) console.log(error);
console.log(JSON.parse(JSON.stringify(results))[0]);
But i need to get it into
```json
"USERID": {
products: {
"mtdrugs": {
ip: "xxx.xxx.xxx.xxx"
}
}
}
How can i do this?
%playername%
ok
// * Converts dataString to json object
JSONObject jsonData = null;
try {
jsonData = (JSONObject) new JSONParser().parse(string);
} catch (ParseException e) {
e.printStackTrace();
}
``` Is what I use.
Is this NodeJS?
no its java. You need to convert it. (I don't use js lol)
You can't just "convert it" to js lol
what does your table structure look like?
if 1 user has multiple products that sounds like you should have multiple tables & do a join
Hi guys, I created a plug-in with the use of placeholderapi. I used JAVA 8 in 1.16.5 but unfortunately placeholders are not registered in 1.18 with java 17, what could I do in your opinion to create a multicompatibility?
recompile plugin with java 17
ugh. pretty sure for the most part, a compiled jar with java 8 will work just fine on java 17. Yeah there's some stuff that has been removed but that's limited and most likely they're not using it
Server doesn't registers plugin's placeholders. Also it doesn't work by putting the jar in the expansion folder, it gives no errors but can't register placeholders
Startup Log Location
Your latest startup log can be found in the logs folder of your
server directory, labeled as latest.log.
Please copy the contents and paste them to a paste service.
Type ?paste for more information.
https://github.com/Kotlin/kotlinx.serialization
GSON is not kotlin-ready, better use library from jetbrains
That is not my problem though
It is a normal behavior I guess, unless you use your own gson instance instead of the JsonSerializationContext provided by the method
TypeAdapterFactory pleading face
So i currently havd a problem where when someone moves it doesnt cancel the command and there is no errors for this
Command Class: https://paste.helpch.at/ikacuhixob.java
Event Class: https://paste.helpch.at/aparunaqul.java
Arrays :https://paste.helpch.at/oranokaget.java
HashMaps: https://paste.helpch.at/megayoxogi.java
Bump
e.getLocation().getWorld().createExplosion(e.getLocation(),explosionPower);
this causes ENTITY_EXPLOSION or BLOCK_EXPLOSION (as damage cause)
i guess ENTITY_EXPLOSION?
I mean there is no entity involved
So whats the damage cause?
Hello How could i create a table with players UUID as the table name ?
Did anyone ever got the world corrupted such that the world.getEntities returns always empty array?
I dont understand why but i have to remake the world each X time⦠maybe something corrupts it but idk what
You can name the table anything you want, but a table per player sounds like a terrible design
You're awful
Your'e
your*
you're are
what
This is not a channel for that, if you want someone to make you a plugin then request on one of those channels
hey š
is & LocalExpansionManager#register#unregister working fine for you all? š
<papi>
you're not supposed to use that if you want to register your own expansion. but instead create a new PlaceholderExpansion object and use the register method provided by PLaceholderExpansion on that object
of course.
Didn't know there is any other way than that, which you wrote above ^
The problem is, that #unregister doesn't work and... I think... I can see why, but maybe I am wrong.
https://github.com/PlaceholderAPI/PlaceholderAPI/discussions/837
Just came to make sure if anyone else has the same problem
And if not... maybe I am dumb or something š¬
ah
If I use low cases in my identifiers, the problem will be 'fixed', I guess
but can be somewhat fixed too, by adding #lowerCase at the end, I guess š (in #unregister)
whatever... just now I figured out the obvious thing, my bad. š¬
brain not working today
what stops you from doing that on your end?
i am saving an arraylist of itemstacks to base64 but it looks like this, is that normal (its so long)?
you can remove the newlines im pretty sure
it adds those \r\ chars but i dont know why
thats part of newline char
why does it create a newline?
it doesn't exactly, I think it moves the cursor to the left or smth
and I also think its only windows now
i am using this for converting to base64
try {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
BukkitObjectOutputStream dataOutput = new BukkitObjectOutputStream(outputStream);
// Write the size of the inventory
dataOutput.writeInt(items.length);
// Save every element in the list
for (int i = 0; i < items.length; i++) {
dataOutput.writeObject(items[i]);
}
// Serialize that array
dataOutput.close();
return Base64Coder.encodeLines(outputStream.toByteArray());
} catch (Exception e) {
throw new IllegalStateException("Unable to save item stacks.", e);
}
}```
tf is Base64Coder
paper does have a safe method for (de)serializing items
why do you ask if you're gonna try your luck with the bot anyway
to see if u can respond before the bot
š
since i dont know the exact method
serializeToBytes
if i log base64 in my console it also creates new lines
yes thats normal
at least for me its normal
u have to remove them
with .replaceAll("\r", "") ?
is there an actual issue with having those newlines there?
if you don't know how the ObjectOutputStream works you should not touch those things
oh alr
like does that cause some problem or anything?
if it aint broke...
I think (\r\n|\r|\n) is better than \r
unless regex has a builtin one
i amm try hikaricp for the 10th time
also use replace not replaceAll if you're not using regex
not sure why it's named that way š¤·
oh
I thought you were talking about ObjectOuputStream & RazerStorm
wait
no I think I use paper method
yes, and then he takes the result of the stream and convert that to base64
alter the result, you're altering the data
btw also shouldn't outputStream be closed
yes but
I remember removing newlines
and it still working
ĀÆ_(ć)_/ĀÆ
idk
So i am importing the paper api,
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
But when i try to use InventoryCloseEvent#getReason() does not work, it looks like i am just importing the spigot api
You need to also add the repository
<repository>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>```
I did
I also tried invalidating Caches, but that didn't work either
Nvm its fixed, idk how but it works now
my code doesnt show placeholders from config but shows the rest on teh scoreboard
https://paste.md-5.net/ifutadigup.cs
my code
Hi! Im pretty new to spigot plugin coding. I am wondering how people are making custom plugins that they use all over there whole server network. For example, they have a lobby and a skywars server and there getting information from the lobby into the skywars server. Can someone explain or help me with making this?
Depends on use case.
Data -> SQL
Commands -> PluginMessaging
There's more but idk what you would actually need for your use case.
So you can connect a database to a plugin to get information from 1 server to another server?
Well you have to write it in a certain way right
Generally each server that interacts either caches the data and they all update eachother through like Redis or PluginMessaging, or they all just query the DB whenever as the definitive source of truth
There's a lot that goes into designing this stuff and that's kinda what I've been grappling with for the past few weeks lol
Making a whole network of servers one shared server so to speak
Ah okay
Subservers ;)
i've got an annotation that's supposed to create a resource file at build time but it's failing to do so. i have registered it in META-INF/services and it's included in the jar. i'm also using gradle and this dep is marked as an annotationProcessor on the target project. any ideas?
https://paste.gg/p/anonymous/820f01ef85124efeb7e8d8abd6bfa654
I wish I didn't forget so easy, How would one make a local maven
Can repost it elsewhere if itās too much of an issue
You need to "set" the supported annotation types so the compiler can give you the elements that are annotated with the annotation you want to process, either override getSupportedAnnotationTypes or annotate your processor class with @SupportedAnnotationTypes
i'm tryna make an insta charge bow rn, doing this by having it so no matter how much u charge the bow it shoots as if it's fully charged. for this though i need the max bow charge velocity. anyone know how i can get that?
need help making a local maven repo
i can't help you but i recommend you add more details about your problem
Hey, I want to break a block for only one player and still make sure that player can move through the broken block, what's the easiest way to do this?
I've been looking at using ProtocolLib but I'm a total noob and have no clue how to and no threads online seem to have the perfect answer for me
just need a place to read on the command and usage on creating a local repo
i gave this a shot and saw no effect
i think Player#sendBlockChange can do this
not sure what I'm doing wrong https://paste.helpch.at/sugivelaqu.cs
I was unable to move though the air block when I tried
thats because the server still thinks the block is there
i believe the only way to do what you want without making some possibly heavy changes to the server jar is to delete the block on the server side, then use packets to show the block for the players that you dont want to see it broken
Wait I'm so dumb, I could just make the blocks air by default and send the block change when I want the block to be visible
Thank you
there are some issues that come with this such as if your using a anticheat, it can be seen as flying
Ok, thank you so much. I was completely clueless š
Thankfully I'm just making a door of some kind so it will be mostly 2D. Don't think that should cause problems, or?
it shouldnt? tho be careful how you implement, if its just for a door, have 2 server states, open and closed, and then for the animation change the block locations to whichever state their supposed to be in
this statement might not make sense
I think I understand, ok thanks!
basically, have a client side only change for every door animation frame, but on the server just have 2 frames, fully shut and fully open. then like 90% of the way through the animation change the door state from closed to open vice versa
I think good anti cheats will listen to packets to avoid that problem
do enchantments not make player heads glow?
or is this some sort of client bug
even adding the enchant with an anvil doesnt work
They don't no
Never have.
Same with chest sadly.
how odd
Don't think thats right...
I mean you can on barrel way not on chest (had make the life more easy when working with a menu for example).
Oh nvm I thought you could add enchant glow.
oo, yeah something i thought to. but sadly you can“t (is no reason for the logic ether).
Spawners can have the enchant glow
Hey...I would like to know if there is a way to check whether any other plugin registered a command...?
I think getCommand(<>) has that
Yeah...
Hello, I'm trying to think about how to make an inventory retrieve all the items in the config.yml and add them to the inventory with a custom slot, a custom name, etc.
I know how to set an item in specific slot in an inventory but i don't with multiple items in config.yml
So If a tripwire hook is placed on a block and you break that block, the tripwire hook will also break. Is there any way to disable this update?
When I do p.getDisplayName() i get their nickname
How do I make sure I just get their original name
getName()
Guys to store like custom enchants on an item (its an example i have to do something near to that) I was thinking about using persistent data container for nbt data and check an array of enchantments when I have to use the effects, but I see I don't know if I can set an array of strings enchantments that contains all, I saw there is the data type TAG_CONTAINER and TAG_CONTAINER_ARRAY, do you know what are those for? Would you suggest me to just add each enchantment as a separate String and just check if he any of the avaiable enchantments with many container.has(....)?
i believe the event you want is the BlockPhysicsEvent
you might still have problems with anticheats, im not entirely sure how anticheats work but i believe they would still get flagged.
even good ones
since i assume they listen to packets coming from both sides and make a decision based on that it could think even tho the server sent a packet saying a block is there, the return response can be seen as flying
I tried that but it isnt working :/
@EventHandler
public void onBlockUpdate(BlockPhysicsEvent e) {
if(e.getBlock().getType() == Material.TRIPWIRE_HOOK) {
e.setCancelled(true);
}
}
what does e.getBlock.getType() output?
hmm lemme check
do like a getLogger#info() message or smth
its not printing anything XD
when i for example break a block that has a tripwire hook attached to
anyone .-.?
Is there anything else I could do to optimize a Minecraft server except Pufferfish and https://github.com/YouHaveTrouble/minecraft-optimization ?
yeah just get good
okay thank
I think EterNity's optimization guide goes more in-depth but overall both explain the same things
found it, thank you
I know it's kept updated with each build that adds something significant, for example Paper recently added a new way to do redstone
i am using that already, noted in yht's guide
Hello, I'm trying to think about how to make an inventory retrieve all the items in the config.yml and add them to the inventory with a custom slot, a custom name, etc. I know how to set an item in specific slot in an inventory but i don't with multiple items in config.yml
how heavy is running
Bukkit.getScheduler().runTaskLaterAsynchronously(...) after 1 tick, for, possibly, 10-100 times a second?
it really depends on what youāre doing inside that task
And you can always monitor it yourself if youāre having doubts with something like spark
if it's async there's unlikely to be any performance penalty
although can you set velocity asynchronously?
I can't for the life of me fix this bug anyone that has an idea https://pastebin.com/m3j3V3Rr (Error) and code https://pastebin.com/QcDRU77Z. Tag me if needed
List<Material> warBlocks = Arrays.asList(Material.CHEST,Material.FURNACE,Material.BARREL,Material.BEEHIVE,Material.BLAST_FURNACE,Material.BREWING_STAND,Material.BUNDLE,Material.CAMPFIRE,Material.CAULDRON,Material.DISPENSER,Material.DROPPER,Material.FLOWER_POT,Material.FURNACE,Material.JUKEBOX,Material.LECTERN,Material.SHULKER_BOX,Material.SMOKER,Material.TRAPPED_CHEST);
@EventHandler
public void onBreak(BlockBreakEvent e){
if(e.getPlayer().getLocation().getWorld().getName().equals("WAR")) {
if (e.getBlock().getType().equals(warBlocks)) {
e.setCancelled(true);
e.getPlayer().sendMessage("You cannot break storage blocks during a war!");
}
}
}```
The line of getType().equals(warBlocks) isnt working
How do I check if a block is inside an array of materials
well a List<Material> will never equal a Material, so you have to do warBlocks.contains(type)
thanks a ton that worked
@EventHandler
public void onInteractEntity(EntityDamageByEntityEvent e) {
if (e.getEntity().getLocation().getWorld().getName().equals("WAR"))
if (e.getEntity() != null) {
if (e.getEntity().getType().equals(EntityType.MINECART_CHEST)) {
e.setCancelled(true);
}
}
}```
How do I disable minecart breaking and opening (in the cse of minecart chests)?
block break event ig
A minecart is an entity though
declaration: package: org.bukkit.event.player, class: PlayerInteractAtEntityEvent
Also, should probably check if the entity is null before trying to get it's location
not sure why it'd be null tho
@EventHandler
public void onInteractEntity(PlayerInteractAtEntityEvent e) {
if (e.getRightClicked().getLocation().getWorld().getName().equals("WAR"))
if (e.getRightClicked() != null) {
if (e.getRightClicked().getType().equals(EntityType.MINECART_CHEST)) {
e.setCancelled(true);
}
}
}```
I tried that
Debugging messages get past null statement
It doesnt even get fired unless i hit an armorstand or itemframe
what is it saying the type of the entity is?
Right clicking the minecart chest doesn't fire that?
PlayerInteractEntityEvent
Right clicking does
okay, try switching the event
minecart_chest is what it returns
it is in caps but cant type it lol
ok
@EventHandler
public void onInteractEntity(PlayerInteractAtEntityEvent e) {
if (e.getRightClicked().getLocation().getWorld().getName().equals("WAR"))
if (e.getRightClicked() != null) {
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "msg Kangaroozy " + e.getRightClicked().getType());
if (e.getRightClicked().getType()== EntityType.MINECART_CHEST) {
e.setCancelled(true);
}
}
}```
Messages me but doesnt cancel
Only fires on opening it
can you put a debug inside
ok
also, I'd still switch it and remove the At
most likely for this reason
At is the same no difference
without the At right?
@EventHandler
public void onInteractEntity(PlayerInteractEntityEvent e) {
if (e.getRightClicked().getLocation().getWorld().getName().equals("WAR"))
if (e.getRightClicked() != null) {
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "msg Kangaroozy " + e.getRightClicked().getType());
if (e.getRightClicked().getType()== EntityType.MINECART_CHEST) {
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "msg Kangaroozy " + e.getRightClicked().getType());
e.setCancelled(true);
}
}
}```
Yea with or without doesnt seem to change it
I want to make them not open and not break
declaration: package: org.bukkit.event.vehicle, class: VehicleDamageEvent
and maybe the opening would be considered entering? https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/vehicle/VehicleEnterEvent.html
declaration: package: org.bukkit.event.vehicle, class: VehicleEnterEvent
Ok yea the works for the no breaking part ty
for the opening part since this isnt cancelling you have any ideas?
this
Unfortunately not
is it all minecart chests?
maybe you can figure it out with inventoryopenevent
I was looking at an older plugin
e.getInventory().getName() might return container.minecart or something similar to identify
that did it, thank you
Whats the best way of looking if a BigInteger value is bigger than a integer value, because you can't use >= operators for bigintegers
.compareTo exists iirc
oh yeah, thanks
yw
how can i regenerate the main world? ive tried googling but the threads i found just go on a rant about other things
using a plugin :/
World#reset()
World#reset() doesnt exist
ofc it doesn't
i dont believe you can reset the main overworld while the server is running, ive seen that you can reset it on startup but i dont believe you can while its loaded
i believe multiverse has its sourcecode public, look through there
You can't reset the main one no, a trick around it could be to use either WE, or CO to revert it back to it's original state while it's loaded
Would probably be a very demanding task tho
your better of just stopping the server and manually resetting it
since you would have to do that anyways to reset the spigot seeds for structures and such
Any mobile app devs pm me
no
no x2
I mean using CO for example, you could just rewind it to the starting state, so all that jazz would still exist
anyone know how to make it so when you shoot an arrow with a bow, no matter how much you charge it it shoots as if it was fully charged. i'm mainly confused about how to replicate the exact velocity of a fully charged bow shot. in 1.8.9 btw
probably just getting the arrow entity, and setting it to the velocity of a fully charged arrow
but... what is the velocity of a fully charged arrow?
Easy way to check that would be to shoot an arrow, and print out it's velocity
velocity is a vector and depends on direction right, so what i need is the multiplier
i'm just not sure how to get that
nvm i think i got it
okay now i have a new problem: when the player faces somewhere around 0 degrees yaw or pitch, it outputs a number like -5 or -3, when it shoud be like -0.01. here is my code:
this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
@Override
public void run() {
Player player = Bukkit.getPlayerExact("Ruskei");
if (player != null) {
System.out.println(player.getEyeLocation().getDirection());
}
}
}, 0, 5);```
example is when i'm facing 0, 0 ( in degrees in the f3 menu) it outputs -6.37, 1.38, 1
but if i move my cursor slightly then i move back to reasonable values like
-0.2
sorry if i'm bad at explaining
nvm solved
I think you're comparing apples to oranges tbh
I don't think those values represent the same thing
Does anyone have a good cost formula for like enchantments on a prison server
item.setType(Material.FLOWER_BANNER_PATTERN);
meta.setDisplayName(ChatColor.RESET + "Pattern");
List<String> loreList = new ArrayList<>();
if(pattern == null){
loreList.add(ChatColor.GRAY + "current Patter = none");
}else {
loreList.add(ChatColor.GRAY + "current Patter = " + pattern);
}
meta.setLore(loreList);
item.setItemMeta(meta);
inventory.setItem(10 , item);
hello! Im trying to make a system where a player can make there own banner. Im using the banner pattern as itemstack but minecraft already put lore on it. how do i remove this?
item.getItemMeta().getLore() doesnt work
look in #showcase for more info
@restive isle if you need to send a picture use an image site like imgur, not #showcase
please remove it
?imgur
You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/upload to upload images/screenshots.
You can also use a screenshot service like gyazo or jinx and post those links here.
getLore or setLore?
ye tried
but it stays
when i do item.getItemMeta().getLore().clear it says item.getItemMeta().getLore() = null
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
⢠HelpChat Paste - How To Use
and just to make sure it's actually setting it
can you change none to NONE
just check if the lore changes
its not about that part
its about the part that says Flower charge
how to remove that
try removing item flags?
Can you copy an entire dir of files from the resources folder? Tried saveResource with the dir path, however that didn't work
Hello everybody! There was such a problem here:
https://paste.helpch.at/ukexuhenud.sql
Here is the code of the main class:
https://paste.helpch.at/bulikelafu.java
you can't have a constructor for the main class
you have to deal with all the initialization in the onEnable method.
I googled this question, but I didn't understand what to do (sorry, I don't think)
you need to put a registerFakeEntityClicker();
run the update task(); in OnEnable?
you need to remove the constructor for the main class. If you do not know what a constructor is you should probably start learning some java before diving into making plugins. here are some great courses and other stuff that can help you learn:
Online Courses:
Online courses are also great for learning java. Some websites that offer them are:
- Coursera - Free unless you want a certificate
- PluralSight - Great courses from what I've seen. Mostly Paid
- Udemy - Never used them myself but they seem to all or at least most be paid.
My first ever course was one from Coursera. - I can say it was pretty good at introducing me to the programming world as a whole not just java.
Oracle Docs:
Oracle docs can help a lot at learning and understanding java:
- Start with this,
- Breeze through this (skipping stuff that doesn't seem relevant like bitwise operators),
- Hit this.
They're the first three from this larger thing which you should definitely go through overall. But those three should be enough for slightly better understanding of what is happening here without feeling like a huge time sink.
That one is a small part of this larger site wherein "Essential Java Classes" and "Collections" also have good useful stuff
Other services:
Some other cool services that will help you learn java are:
As you can see there are plenty of good ways to learn as long as you're willing to invest the time. Have fun learning!
This is actually purely lies
There are many things you can do in the constructor
Some of it is too early tho
For a lot/most of the spigot related shit
when I say main class, I am referring to a class that extends JavaPlugin.
You can have constructors. It just needs a no-args constructor to create the plugin class
I guess maybe you can have an empty constructoir?
yeah. Ic. I wasn't sure.
empty meaning no args. yeah
I've never needed one but I've seen somewhere before someone saying you can't have one at all and it just stuck with me I guess
I see
Yes ik
Does GriefPrevention and other protection plugins prevents falling blocks (spawned by a plugin) convert into solid blocks on ground?
Doubt it. Since there is no event to check when a block is spawned (by the api)
there isnt a block from event or similar?
Thought you wanted specifically from plugins. There is an event for when falling blocks convert to blocks.
Yes it should be EntityChangeBlockEvent i think
Is there a sort of recommended or de facto standard way to log messages from a placeholder expansion?
Or should I perhaps just not try to log anything? I have placeholders that are "conditionally valid", i.e. they are valid if a certain plugin is installed, but invalid otherwise. I'd like to return null when the plugin isn't installed, to signal that the placeholder is invalid in this context, but perhaps also provide a helpful log message about it.
Thanks! I was apparently programming against 2.10.10, which does not have these methods š
np
is there anyone?
no
Ā» Give the helpers some details
Ā» Ask suitable questions
Ā» Be polite
Ā» Wait
Barry is
its launch break. everyone's outside
does anyone knows how I can optimize this?
@EventHandler(priority = EventPriority.LOWEST)
public void Join(final PlayerJoinEvent e1) {
final Player player = e1.getPlayer();
if (!player.hasPermission("vote.reminder")) {
new BukkitRunnable() {
public void run() {
String joinText = "&f\n&7&a&lVOTE &fRemember to vote on /vote for epic rewards!\n&f&l%VotingPlugin_VotePartyVotesNeeded% votes are needed for a party!\n ";
joinText = PlaceholderAPI.setPlaceholders(e1.getPlayer(), joinText);
player.sendMessage(ClaimVIPPlugin.colourise(joinText));
}
}.runTaskLaterAsynchronously(ClaimVIPPlugin.getInstance(), 50L);
}
}```
ClaimVIP::Event: m.d.c.Join (PlayerJoinEvent)count(96) total(1.24% 0.156s, 2.05% of tick)avg(1.62ms per - 1.02ms/0.63 per tick)
I mean there's nothing there to optimize
our
whats the point of doing that async
holy shit 2% of the tick
do not do that async is how to optimize that
if you really want to do it async, use like AsyncPlayerJoinEvent from Paper or something jesus christ
player could be null by the time he runs the task as well
what?
}.runTaskLaterAsynchronously(ClaimVIPPlugin.getInstance(), 50L);
i assume thats 50 ticks later
which is 2 and a half seconds
if they leave
you have no online check
its going to error
err probably not, pretty sure CB checks if the connection reference is valid before sending packets
I am making a duel plugin, and my question is, what is the best way to save the spawnpoints of the players?
profile with spark not timings
š
Server thread0.65%
me.decepticon.claimvip.Join.Join()0.63%
me.decepticon.claimvip.Join$1.run()0.02%```
spark
also that's without the task being async ^
yeah
can you send the profiler link
a config
or you can save it in a database if you have multiple instances of the server
you can have it structured like so
arenas:
arena1:
spawnpoint-a:
x: 0
y: 0
z: 0
spawnpoint-b:
x: 0
y: 0
z: 0
arena2:
spawnpoint-a:
x: 0
y: 0
z: 0
spawnpoint-b:
x: 0
y: 0
z: 0
then you would just loop through the keys of "arenas"
Depends how ur infra works
Is it all on one server or what?
I'd like to ask for help with the PaperComponents.legacySectionSerializer().serialize(Ė) method.
It says it is deprecated and I tried to use the class it recommends instead but that doesn't work this one worked ā it shows some weird text.
So when I change the code from
String legacyText = PaperComponents.legacySectionSerializer().serialize(displayName);
to
String legacyText = LegacyComponentSerializer.legacySection().serialize(displayName);
as it recommends, legacyText changes from §f[§9§oTester§f] to §fchat.square_brackets
EDIT: Solved, had to upgrade my paper to latest version
and what's the input?
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
⢠HelpChat Paste - How To Use
Have you debugged your saving process?
strange
Assuming you're running this on player join?
No clue to be honest, must be something with the encryption then if that's where it's happening, but I don't see anything off
Hello, i made a plugin when i click on an item it will hide all players. But when i disconnect and reconnect they are no longer hidden. So whats the best way to keep them hidden if he activated the item ? Should i use Ć config.yml or a database or other methods? Which one is the more efficient if there are alot of players

or did I




