#help-archived
1 messages ยท Page 39 of 1
What's wrong here?
{
//player
Player player = (Player) sender;
String name = player.getName();
player.sendMessage(ChatColor.BLUE + "You have been granted access to play the game.");
}```
ok, but some where in the menus you can invalidate the caches @buoyant path
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event)
{
//player
Player player = event.getPlayer();
String name = player.getName();
player.sendMessage(ChatColor.BLUE + "You have been granted access to play the game.");
}```
also
there is not a sender lol
Was going to mention the same, yea
I changed that in the code I posted
Grab it from the event. You should have a basic understanding of how the language works before writing plugins
Pulling variables out of thin air is one of those mistakes you should not be making
but its suppose to be magic
I mean how do I fix this then, i'm trying to change a command to join event
Dude we've answered you twice now lol
https://imgur.com/a/wz0xiIK Block won't showup for some weird reason
I found the invalidate caches thing Frostalf
Maybe its bungee
Dude I don't know how tf to do this
the code is literally right there lol
just copy paste it over yours
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event)
{
//player
Player player = event.getPlayer();
String name = player.getName();
player.sendMessage(ChatColor.BLUE + "You have been granted access to play the game.");
}```
You just forgot the actualy playerjoinevent
personally I don't use IJ, but I hear sometimes you have to do that when something weird is happening in the IDE that can't be explained XD
homie
NetBeans
NetBeans is comparable to IJ
Yeah ig
I never learned this in school I taught myself lol
same, but I get college credit for a skill I'm already decent with
Oh true
Ah, we have another NB user. I thought you were in IJ for some reason, Frostalf
But how do I find the god damn name
hey bruh
hover over the error
I have tried out IJ, just didn't like the feel of it. I don't doubt IJ is good, but I prefer NB
I used to use eclipse for like 3 years
more like visual studios and thats where I came from
besides netbeans lets me tweak the resources it uses to a degree easily ๐
so its nastolgic
What u mean hover over the error
plus since I'm technically a college student I get intellij ultimate edition free
cool plugins
you need to import the relevant packages that your class is making use of
java.lang.NoClassDefFoundError: com/zaxxer/hikari/HikariConfig```
im so upset lol
I cant get this working jesus christ
still not shading o.O
you will find typing in all CAPS isn't the wisest of things to do
nor does it solve your problem any better lol
it sounds like you need to learn more in how to use Java
Novato, I seriously advise taking time to learn the language instead. These are basic issues you could easily resolve yourself with a few minutes of research or an understanding of the language
Choco you good with maven ? lol
This is not a Spigot issue, this is a lack of Java knowledge issue
Oh wow, didn't figure you for an eclipse user lol
All day erry day
I get NoClassDefFoundError when using HikariCP because my maven wont compile it
won't shade it
^
What's your shade plugin look like (probably sent it already, didn't see)
yes, its way up above probably wise if he just resends the link for it
Only thing I would probably remove or just comment it out to just try it, is
<includes>
<include>com.zaxxer:*:*:*</include>
</includes>
</artifactSet>```
generally not necessary to have that
is that really gonna change the outcome? lol
Agreed. By default it will shade anything set to compile scope
Like I have said earlier only times I have had to set includes or excludes is when I have to deal with transitive dependencies
I also don't think :*:*:* is valid
which is dependencies of the dependencies XD
It would just be com.zaxxer:*
Well why doesnt this send a message:
{
Player player = event.getPlayer();
String name = player.getName();
player.sendMessage(ChatColor.BLUE + "Welcome " + name + "! Use /play to get access to commands. Do /commandsupport to learn more about commands.");
}```
first one is group, second is artifact the third is version @subtle blade
What
Can I see your class that extends JavaPlugin
Oh
public class Main extends JavaPlugin{
package to filter on, group id, artifact id, version```
Frostalf could I see one of the pom.xmls you have used when using HikariCP before?
it is correct, but yeah I would try removing the extra *'s though generally doesn't need all that either when using includes
It assumes wildcard if not specified anyways
ah right forgot about that as well
But yea, that looks fine to me. Could be that IJ's Maven isn't sync'd with your pom? IDK. IJ does some fucky shit that I really hate
If you can refresh your Maven project at all, definitely do that
Yea but there's actually an option to refresh your maven project
oh
You have to do it every time you add a dependency
(or make any change for that matter)
interesting, never knew that. That is something in NB you don't have to do as it takes care of that for you XD
In Eclipse I can just hit F5 
Ill try it
only time I would have to reload a project is if I edited the Pom manually but generally NB detects external changes
very rarely do I have to tell NB to do it
Build for the 300th time praying that it works lol
alright im off to bed. i'm absolutely exhausted. work killed me today lol
don't worry I have had to build a project numerous times to get something resolved that just wouldn't work. As I said, I learned all about transitive dependencies especially with shading. I had that problem where a dependency or two kept bringing in the API for shading XD
this is so bad
do you actually have the dependency downloaded?
HikariCP that is
that is the only thing I can think of, is that maven is trying to pull the dependency in, but isn't fetching it from the right place or at all
and just simply skips it
is it in your local maven repo?
No idek where that is
if the dependency isn't in the local repository then I would manually install the dependency to the local repo
ok, try this then, navigate to your project directory open a command prompt as admin there
run mvn clean package install from the command line
if that still doesn't work then I really have no idea why IJ or maven isn't shading that in at all
and it wasn't HikariCP that I use as I learned, its BoneCP
I'm working on a socket application for my plugin so that my client doesnt have to open console or mc to send messages, so I made a thread, that runs a runnable, that runs a Timer, that runs a timertask, to send messages to the socketserver whenever a message is made
the timer works well
until a message is sent to the socketserver
// Timerclass
public SocketTimer(GUIMC gui) {
Timer timer = new Timer();
timer.scheduleAtFixedRate(
new TimerTask() {
int counting = 0;
@Override
public void run() {
counting++;
gui.getConnectedLabel().setText("DEBUG: " + counting);
for (String str : new ArrayList<String>(queue)) {
if (str == null) continue;
gui.getConnectedLabel().setText("sending: " + str);
SocketSender.sendMessage(gui.getIP(), gui.getPort(), str);
queue.clear();
}
}
}, 50, 50);
}```
private static Socket client = null;
public static boolean initialize(String ip, int port) {
try {
client = new Socket(ip, port);
} catch (IOException e) {
// TODO Auto-generated catch block
GUIMC.instance.getConnectedLabel().setText("Failed to write.");
System.out.println("[Error] Failed to create Writers.");
return false;
}
return true;
}
public static boolean sendMessage(String ip, int port, String message) {
initialize(ip, port);
try {
DataOutputStream dOut = new DataOutputStream(client.getOutputStream());
dOut.writeByte(1);
dOut.writeUTF(message);
dOut.flush();
dOut.close();
} catch (IOException e) {
GUIMC.instance.getConnectedLabel().setText("Failed to connect.");
System.out.println("[Error] Failed to connect to the remote Server.");
return false;
}
return true;
}```
Not neat
i was desperate
Frostalf
do i need these lines
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>```
something like that?
Anyone work with MongoDB..?
you probably should add it in there @buoyant path as I recall maven picking up the source and target using those as opposed to the ones set in the compiler area.
I generally have both
why is mvn not a command in my terminal
that means you don't have maven installed and instead are making use of the one that IJ provides
I have maven installed and tell NB to use the maven version I have installed as opposed to using one that it provides
Where can I install maven or is that even necessary
shouldn't be necessary but its quite helpful sometimes in situations like yours because using the command line would eliminate if its IJ just not doing it or it really is a problem with maven
you will have to add the variables to the global path in windows though if you choose to install it since it doesn't have an installer
Yeah apparently IJ's build artifacts does so independently from maven
anyways, I will be away for a bit of time. Will be back though.
it does connect
but
when it send the message or data to the socket server
the timer stops working
Im just gonna try to add it as a jar file to my project structure
ill get it working with maven later
Anyone work with MongoDB..?
hey im making a spawn and i'd like to have a phantom spinning around a certain area. how do i make it turn into a "robot" kinda
like what plugin,
not actually turn it into a robot, but make it do what i tell it to and nothing else
why are you using a timer for it @raw basin ?
if anything should be using a while loop
Need help on a hub
Hey just a quick one about IntelliJ & maven, can't seem to get libsdisguises to load up
On the maven tab, when I go to dependencies and click LisDisguises:LibsDisguises:9.5.1 their protocollib is underlined red (com.comphenix.protocol:ProtocolLib:4.4.0-SNAPSHOT)
Any ideas if I can do anything to fix this?
Is there a plugin that automatically starts an event ecery few hours and rewards the winner with stuff?
like say a fishing event
and person who catches most fish wins stufd
Yell @edgy sail
wat
it wasnt for you
Ty md, missed your message ~~Incase anybody might be able to help, this is what I see when I come to compile: https://i.imgur.com/B0ccvNq.png~~
@tiny dagger i dont know how to code much
Im a beginner
Says its likely to have game breaking bugs
ugh
why don't you take a search on spigot? ๐ค
you can even type on google to get a popularity sorted result
how can i make a floating text that says "&e Notice"?
/summon ArmorStand ~ ~-2 ~ {Invisible:1b,Invulnerable:1b,NoGravity:1b,CustomName:"Harry's Shop",CustomNameVisible:1}
it does not work in 1.15.2
anybody know?
yes
and if yes how
i dont see it
bruh
Maybe somthing like int?
there was an entire documentation page on how to use it
that would be useful yes
But i need to find it on the documentation
And i dont know which section variables are under
Ye idk which section
when I use Inventory inv = Bukkit.createInventory(player, 36, "test"); it doesn't let players put items in their inventory though the gui works
on join:
set {_player} to player
wait a minute
message "%{_player}%" # the local variable is unchanged no matter how many players joined in the meantime
there is a forum for skript people on spigot..
So i would need a local variable to have multiple of thar
Bur i also need a normal one to keep the highest one in
i haven't used it in like 5 years
how do you make a tiny armor stand
i wanna make hypixels minions
as a plugin
how do you code suhh cb
armorstand.setSmall(true); gets me a nullpointe
i am using citizens api btw
i created an npc with type armor stand
Idk anything about citizens API ๐คทโโ๏ธ
Why not just spawn a normal armorstand? Does citizens do something neat with it?
does setsmall make it tiny
yes
It's just a datawatcher value
@lusty vortex
I tried setSmall
i realized
i fixed it
but it is still not small
i got nullers before because i tried it before spawning it
here is my code
it is not small
NPC npc = CitizensAPI.getNPCRegistry().createNPC(EntityType.ARMOR_STAND, userName);
if (npc.isSpawned()) {
ArmorStand armorStand = (ArmorStand) npc.getEntity();
armorStand.setSmall(true);
armorStand.setHelmet(new ItemStack(Material.GOLD_HELMET));
p.sendMessage(ChatColor.GREEN + "Successfully spawned " + userName);
}```
it is not small
Wtf? Citizen's scammed you
Maybe a bug with the Citizen's plugin. They scammed you
im using quite a late version
You should print the class that "npc" is
.getClass().getSimpleName(). Something like that
i am debugging
Then cast it directly to that class and see if another function exists
๐
@tiny dagger
do you know math
like about radius'
and stuff
i have a more math question
well ask
ok so I have an npc
it moves around
what I did is made it move around in a circle
like this
(sending a video)
..
that
It moves straight and backwards
I want it to turn the amount that is needed
by setting yaw, but I need to calculate how much to turn
๐
Hello! I need help with my Bungeecord. Everytime, when i join: http://i.uf1.ch/javaw_tArt9G7min.png
knows anyone this problem?
oh so you want the head to follow the center?
me?
if you need
well what do you do now vector?
private Location getLoc(double angle) {
double x = center.getX() + radius * Math.cos(angle);
double z = center.getZ() + radius * Math.sin(angle);
return new Location(center.getWorld(), x, center.getY(), z);
}```
i want a new yaw
to make him look at
use vector :p
private double radius;
private static final float SEPARATOR = 2;
private static final float RAD_PER_SEC = 1.5F;
private static final float RAD_PER_TICK = RAD_PER_SEC / 20F;
radius is set to 2
Location loc = getLoc(RAD_PER_TICK * tick + SEPARATOR);
but i can help you do it this way wait
ok
all i do is teleport the npc
so if you can help me with the rest
it would mean the a lot
wait
but the angle is in radians right?
why don't you do yaw + Math.toDegree(angle)
at location
@frigid ember
set pitch at 0
@tiny dagger
not what I want
i want him to walk like ahuman
he looks where he turns
yay
it works
@tiny dagger another math question
xd
can u help me?
unrelated
Can anyone help me xd?
no i have to work at something
What I want to do, is get the yaw and pitch needed, to look at a player
i want to be able to calculate
the yaw and pitch needed to look at a given entity
like
look at Bukkit's Vector
getDirection more exactly
i said just look
and copy paste from there
vector is just a point from a going to b
where a in bukkit is a location
and b the vector
pasta
i said i want pasta
i don't have time
find someone else to bother :p
use that
you're fine
as a side note
get direction is already normalized
you can remove it i forgot
@tiny dagger
yo
this is what i want
public float getPitchToLookAt(Player p, Entity target) {
///code
}```
and same for yaw
ooh
go on your keyboard
and click inspect or something
there is some key on the top riught
that you clicked
causing this
np
insert*
yea
i meant
lmao
fr33styler
howd o i do what i need
thisis wha ti have currently
Vector vec = pLoc.subtract(entityLoc).getDirection();
as u sent that
that's not what you need tho
you need ploc.toVector()
ok
same for entity
Vector vecP = pLoc.getDirection();
then
Vector vecP = pLoc.getDirection();
Vector vecEntity = entityLoc.getDirection();```
no just no
ok
oh
k
Vector vecP = pLoc.toVector();
Vector vecEntity = entityLoc.toVector();```
then?
stop asking me for every small change
vecP.angle()
you'll never learn this way
an angle
Vector vecP = pLoc.toVector();
Vector vecEntity = entityLoc.toVector();
float angle = vecP.angle(vecEntity);```
No, that will run after 30 minutes
wrong screenshot
And then every 2.5 seconds afterwards
Yes
That will run immediately and then every minute
Oh wait sorry every 30 minutes
Didn't see the 30
Yeah that method returns a BukkitTask
Which has got a cancel method
can i make a task within a task ?
and also, what is the method to make a task which provides a method that i can run code at the end of the task ?
if that makes sense :p
Yeah you just have to call the task method from within your task
I mean, you just have to manually call your code that you want to be run when you call the cancel method
Or if it's not a repeating task, then you can simply add your code at the end of the run method
@EventHandler
public void onPlace(BlockPlaceEvent e) {
Block block = e.getBlockPlaced();
Player player = e.getPlayer();
if (block.getType().equals(Material.MOB_SPAWNER)) {
for (int x=0; x<=16; x++) {
for (int y=0; y<=256; y++) {
for (int z=0; z<=16; z++) {
Block blockInChunk = block.getWorld().getBlockAt(x, y, z);
if (blockInChunk.getType().equals(Material.MOB_SPAWNER)) {
CreatureSpawner placedSpawner = (CreatureSpawner) block;
CreatureSpawner chunkSpawner = (CreatureSpawner) blockInChunk;
if (placedSpawner.getSpawnedType().equals(chunkSpawner.getSpawnedType())) {
e.setCancelled(true);
sendMsg(player, "&cYou may not place more than one identical spawner in a chunk!");
}
}
}
}
}
}
}
My code currently just checks the first chunk, not the chunk in which the block is being placed in, how can I modify my code for it to operate as intended?
can anyone explain why dosent the rank "show up" in my tab list
I'm using luck perms and rank grant plus
@remote socket use block.getChunk().getBlock(x, y, z) instead
also adjust your for loops
for (int x = 0; x < 16; x++) {
for (int y = 0; y < 256; y++) {
for (int z = 0; z < 16; z++) {
// stuff
}
}
}
because rn, you're checking 17x257x17 blocks instead of 16x256x16
oops
Block blockInChunk = block.getChunk().getBlock(x, y, z);
if (blockInChunk.getType().equals(Material.MOB_SPAWNER)) {
sendMsg(player, "There's a spawner already in this chunk!");
CreatureSpawner placedSpawner = (CreatureSpawner) block;
CreatureSpawner chunkSpawner = (CreatureSpawner) blockInChunk;
if (placedSpawner.getSpawnedType().equals(chunkSpawner.getSpawnedType())) {
e.setCancelled(true);
sendMsg(player, "&cYou may not place more than one identical spawner in a chunk!");
}
}
This is sending the There's a spawner already in this chunk! message despite there not being
did you check if there is a vanilla spawner below ground?
error
you can't directly cast the Block to a CreatureSpawner
you need to cast Block#getState
so in your case
CreatureSpawner placedSpawner = (CreatureSpawner) block.getState();
CreatureSpawner chunkSpawner = (CreatureSpawner) blockInChunk.getState();
yep there is for sure not another spawner
probably the spawner you placed
how can i exclude the spawner that is being placed? Get the location of the placed block and block in the chunk and check if they are the same?
you can get a blocks chunk offset coordinates by using the % operator
~~```
xOffset = block.getX() % 16;
zOffset = block.getZ() % 16;
and then when x == xOffset && y == block.getY() && z == zOffset you can just use continue;
actually
use bit masking, because this doesn't work properly for negative coordinates
cant u just do when block.location().equals(chunkblock.location())
hehe
Hello I am looking for a plugin allowing to put a cooldown enderpearl or another item in a selected region
Who knows a levels progression plugin like PvPLevels?
I do not find
with the crafting events is it possible to change the outcome without using recipes? like say i put two items in my inventory crafting window and want a outcome based on the nbt tags teh first two items have (regardless of if they are a normal recipe)
Anybody remember the name of that plugin that lets you spell out your username in particles above your head? No worries if not, can't find it anywhere on Google!
Found something if anyone else is wondering now ^ https://github.com/Slikey/EffectLib/blob/e8fa4d8362cb65e9be3958a075001e273d9a43c3/src/main/java/de/slikey/effectlib/effect/TextEffect.java#L129
Shouldn't upgrading from Java 8 (server) to Java 11 be compatible with all plugins supporting Java 8 ?
99% will work, yes
but there is always that one stupid plugin that tries to access a private final field or some bullshit
oh right, final only broke with java 13 I think
As it happens it is two plugins in my current setup ๐ Will try to contact the owners instead. ๐ Thanks
Would a long function/method cause the server to lag? (BlockBreakEvent)
Potentially. Depends on what you're doing
its over 500 lines
Plugins can also break if they are using javafx, most notabily javafx's Pair class.
Well that's just developer stupidity ;P
Quick question boys wich one should i go for to make a interruptable timer,should i cancel a runnable and start it again with the new time or.. create my own timer wich gets updated with a 1sec runnable(x++)
?paste the method, OhSry. I'm sure it can be improved
Because that event is obviously called every time a block is broken
Oh dear, yea, she's a lengthy one
Its for custom enchants
Though a lot of it can be simplified I'm sure
someone know if its possible to translate this message? and where is allocated? thanks!
Checking if block material ends with _ORE then use that to give player the material for once...
No. You'd be better off mapping
EnumMap Material to IS
I'll take a run through it and give you a list of changes you can make to simplify a lot of that
Yeah might be better
@subtle blade should I do a for loop for the items enchants then do a switch case:
for(Map.Entry<Enchantment, Integer> enchants : item.getEnchantments()) {
switch(enchants.getKey()) {
case(new Oblivion):
//code
break;
}
}
Or would that cause more lag
1 sec ;P I'll write it down
kk
someone know if its possible to translate this message? and where is allocated? thanks!
@floral raptor pls tag me if some one knows how to do
What plugin are you using?
is a server of mods
ah
Whats the mod called
pixelmon
Any config files?
that message is not in the config files
so i dont know where came
i think its from forge.jar
yes but i want to translate
because players dont speak english
and dont know what is that
its the mod warning usually there is no config about it
i also don't add translation in my code warnings
it may do the job
okey
best? restarting a runnable with a new timer,or make own timer using a 1 sec runnable?
Also plugins donโt work on forge lol
we need a csgo system
where we can download a servers required mods on a click ๐
How do I modify the attack speed for items?
@paper compass https://paste.md-5.net/roqibokuqi.diff
Here's all that I caught
There were some other minor things I didn't really bother mentioning but those were the biggest things that may impact performance and/or readability
@zenith siren you mean the cooldown?
Yea
your gonna have to work with attributes in itemmeta
or if its easyer for you with nbt
@subtle blade What do you mean by All this enchantment logic should be handled in the enchantment classes themselves.
Is it necessary to call .toLowerCase() on PermissionAttachmentInfo#getPermission()
Your enchantment classes should define a method. Say, onBreakBlock. That method can take any information it needs. The ItemStack, the Block it broke, whatever. Put all your block breaking logic into there. On enable, you should register just a single instance of your enchantments into some Map or something where you can uniquely identify and retrieve them. When you want to call the logic, grab them from that registry, call the onBreakBlock() and boom. Magic!
How do I create a new Thread again? I forgot
new Thread()
b r u h
lol
But how do I put something inside?
lmao
learn java
You would want to work with the scheduler
he caught it
ffs
Thanks choco, I forgot about that.
my preferred way is using a lambda tbh
dont dm ppl, just ask here
Hey guys i was wondering if u knew a plugin to disable player volunteer disconnect in a pvp fight in warzone ?
can't stop people disconnecting but you can punish them for disconnecting
Yeah a punish would be great
the one I used for a long time , I haven't used recently it because now I have my own, but it should still be great.
I think ill go with this one
Hey guys got any idea how to cover a string from config as world
Bukkit.getWorld(string);
No actually
Location loc = new Location (cs.getString("world")....)
So it expects World there
But provided is a string
Is there anyway i make it read the string text as world but not a actual string
Bukkit.getWorld(cs.getString("world")) ?
OwO idk i tried this method or no
I tried most of em
Anyway TY
Ill try this one out hope it helps
Can return null (if the world doesn't exist). Check this first
Yes it was a warp plugin i was working on and ive done those checks i just wanted a way to covert that string to world cuz Location expects actual world ๐คท
seems when you do a custom item nbt based recipe using the PrepareItemCraftEvent - the source stack increments in size when over stack size of 1?
Yes in my opinion pebblehost is better choice
anyone have an example of 1.14 ItemCraftEvent?
install placeholderapi and do /papi ecloud download player
would not recommend PebbleHost to be honest
they had their MySQL Database crash three times in a few months, not to mention downtimes
Our old host (Shockbyte) went down about 3 times a day
that's why you get a dedicated server
Yeah I think they resell OVH after all
yeah kimsufi
im asking but not seen any responses yet
not like it was on irc anyway
maybe there should be a seperate api channel
Anyone here work with MongoDB?
@paper compass Get a dedicated server or VPS and install Pterodactyl ๐
Hi, I have a (hopefully) quick question... I am creating plugin that will count score based on time. As a time source I chose server ticks as I thought would be cleanest solution (Yea, I could use System.currentTimeMillis()). Now the funny part, I thought that World.getFullTime is the thing I wanted - time since first server start. But when I call /time set 1000 in-game, both World.getTime and World.getFullTime are set to 1000. In game, I can run /time query gametime, which seems to be the thing I need. Am I doing something wrong? Or how do I obtain the "gametime" from code? Thank you for any help!
meh VPS usually aren't meant to host game-servers
@green hornet Thanks for answer, unfortunately simple outputting getTime & getFulltime returns numbers described in previous posts... :/
youd expect time query gametime to return the same
getWorld().getTime() % 2147483647L
getFullTime returns the time in the current day. getTime returns the full time % 24000. There is no API that exposes the actual time you are after
@little crater @green hornet So the correct solution is indeed to use currentTimeMillis()...
if you're going to use nms to get that, might as well use nms to get the time you want ((CraftWorld)world).getHandle().worldData.getTime()
i think you are wanting to just store the timestamp on plugin start right?
I thought that World.getFullTime is the thing I wanted - time since first server start
and you are asking if that exists?
@green hornet I am storing time since the game I am scoring started, so I can measure score and determine if that is time to end the game... Also I am storing the time on disk, so it will work correctly after server restart...
@little crater I will try that, thank you!
Poor Billy Henderson
hmm seems CraftItemEvent only fires on normal recipes ๐ค
If you've registered a custom recipe it should surely fire too
Called when the recipe of an Item is completed inside a crafting matrix
my recipe is based on nbt tags of the itemstacks
so i dont think i can use recipes for that? would be nice if so
so this is never firing to correct the source stacks item amount
Hello, I am not very good at English, t K I am not a native owner of this language - not the point. When it will be possible to send software packages (plugin messages) during the PlayerJoinEvent event and not to put a delay, at the moment I just use my channel on netty
i think RecipeChoice.ExactChoice will solve my problem, thanks all
So i'm using this when someone tries to join and is banned, however instead of displaying the message, it just displays "Failed to connect to server", any idea why?
BaseComponent[] message = TextComponent.fromLegacyText(String.join("\n", convertedBanLines));
e.setCancelReason(message);
e.setCancelled(true);
it's bungee sorry mbmb
Probably should've explained a lil more
using bungee version 1.15-SNAPSHOT and using "LoginEvent"
Me an intelectual spending 15min to figure out getting minutes out of a int
private int[] getMinutes(Integer time) {
int remTime = time;
int minutes = 0;
while(remTime>=60) {
remTime-=60;
minutes++;
}
return new int[] {minutes,remTime};
}
hmm so i cant use CraftItemEvent and i cant use recipes ๐ค
why you cant use recipes?
craftitemevent doesnt fire unless its in the recipe list
@vernal spruce I am using following: leadingZero(time / 60) + ":" + leadingZero(time % 60)
@sacred wave im getting 2 ints to check if seconds = 0
so i dont have 5 minutes and 0 seconds,more like only 5 minutes
show code on how you did the recipe
i have about 14000 recipes so it seems to be exceeding the packet limit
?paste
@vernal spruce time / 60 will return only five minutes, no decimals, since this is integer division...
I'm trying to check if a Blaze is in water
e.getEntity().getLocation().subtract(0.0, 0.5, 0.0).getBlock().getType().equals(Material.WATER)
This doesn't work, how would I do it
isnt there a method to check if a entity is wet?
try check the breathing code in spigot source
nvm
@vernal spruce @ashen stirrup I guess Blaze.isSwimming is what you are after
I guess Blaze.isSwimming is what you are after
Cheers, I'll try it
@ashen stirrup but I am not sure whether this will return true for lava or not
it probably will though
I need a 1.8 method
@ashen stirrup oh, I see. Another method might be (not sure if it was in game like this in 1.8) wait for entity damage event, since Blazes are damaged in water (at least in 1.15)
They always were
not sure what the DamageCause will be, whether suffocation, contact or something else...
It might just be GENERIC. I don't see where in NMS blazes take damage from water
I know they do, I just don't know where to look to confirm
probably something dumb like drowning damage
yup it is Drowning, just tried ๐
damn you mojang
How do I give the tablist multiple columns? Do I need to do it via a packet?
@silk bane @subtle blade Isn't that possible that Blazes are implemented that they don't have any bubbles (don't know the api name)? Hence the DROWNING damage...
What would the DamageCause be? They don't drown do they?
they take damage in rain
which doesn't affect your air
mojang just decided to make it drowning
So it's drowning?
apparently.
@silk bane true, will try what does rain damage returns...
So in my minigame framework, I'm making a generic sorted stats value, for instance kills in a particular arena, deaths in a particular arena etc. I decided to create a class, StatKey for this
public final class StatKey {
@Getter private final String key;
@Getter private final String stat;
public StatKey(final String key, final String stat){
this.key = key;
this.stat = stat;
}
@Override
public String toString(){ return key + "." + stat; }
}```
And I've created two Maps (one for global stats, the other for sorted stats)
```java
private Map<String, Integer> stats = new HashMap<>();
//StatKey = key, stat, value for instance a particular arena, "kills" being the stat and the value.
private Map<StatKey, Integer> sortedStats = new HashMap<>();```
I just feel like there's a neater, more readable way to approach this. Any suggestions? (Note that for Stats, I can't use an enum as this is a framework, meaning more type of stats will be added depending on the minigames using this framework).
Not sure Mojang has any reason to make it its own damage reason
It would have no use
@ashen stirrup at least that's what I got...
Still curious where the actual call to damage is
Couldnโt find it after a quick browse
@ashen stirrup imho you can even prevent this damage this way, as EntityDamageEvent is Cancelable
@unreal hedge just use Map<String, Integer> or maybe Map<StatType, Integer>, where StatType is an enum
I'm not going to make an enum for every possible combination of stat types lol
It could be kills, using a particular item or ability
Woo! EnumMap!
The reason why they exist, is for challenges.
use string then
Gross
yeah
yuck
๐ it's either I use Strings in the framework, or recreate this system every time per minigame with enums for every possible combination, yeh I'll stick with ma strings xD
@subtle blade @ashen stirrup Unfortunately it is still DROWNING for rain...
If raining and exposed to the sky, itโs likely rain damage. Else itโs water damage
Should I use something else?
yes.
To represent something like this
Oh my god please do
feels like I should use a tree
Or just a proper object lol
feels like you should figure out what you want to do with that data rather than just trying to store it all as it appears
well
im stupiud
bye
time for bed
much better
I forgot I made an object for this lol
Multimaps: "Am I a joke to you?"
Anyone here work with MongoDB?
Just ask your question
Im trying to use ViaVersion and it still only lets 12.2
oh nevermind its just something with 1.8
When I call ConfigurationSection#getValues if the value in config is an integer what would be it's type in the map?
getValues() returns a Map of keys to values
If it's an int, its type will be Integer
๐ Thanks
My server is based on 1.7 with 1.8 support and when 1.8 player joins my 1.7 players are getting kicked for [Proxy] Lost connection to the server. Btw they get kicked only if the 1.8 player is in their view distance. Using Flame Cord btw. And no errors at console.
Not sure if anybody even bothers giving support to 1.7.. its bit too oudated
That sucks, i know a bunch of servers that fixed this just dunno how, maybe i should try viaversion or something else.
How can enum be null in runtime can someone tell me?
ChatColor test = null;
no
well
Not possible
you see "Ahron null" in console?
[20:43:35 INFO]: Ahron null
fresh copied from console
show the champion class
is AHRON an enum or a public field? ๐ค
!paste
most likely you have a toString method
?paste
HJNFahbsdlfa
ninja'd!
Don't know what you're talking about, Mini
You're constructing that listener within the enum itself
It's null at that point
lol
interesting, I would expect a not initialized error instead
Me too
Suppose you could instead pass a Function<Champion, Listener> to construct the listener and build it in the enum's constructor while passing an instance of the enum itself
Though really, I think this is a flawed design
for some reason if players click a grass block in slot eleven of their inventory, it does the same thing as when a player opens my gui and clicks the 11th slot. Is there anyway I can make it so players can't put a grass block in their inventory and trigger the same thing that the gui triggers?
I would design it like this:
add a Class to the enum instead of the actual listener
have some method somewhere that iterates over Champions.values, gets the listener class, initializes it and registers the event handler
Check if the slot number is between 0 and 35. If so, ignore it
i don't understand why it's null tho
Actually, slot numbers might be different
simply removed Listeners from enum.
really thanks for tip.
its not constructed yet konsolas
but I need the block in a higher slot, as my inventory is only 36 slots big
@pastel condor There are a few things you could do. In your GUI code, check that the inventory isn't a player's inventory. Or you could check that the inventory is a specific inventory.
It is the players inventory
Yea, clicked inventory instanceof PlayerInventory would work fine
^
because I don't know what else to use
kinda
It can't be kinda
Change player to null and just use that
Then in your GUI code check that the clicked inventory is not an instanceof PlayerInventory
enum Test {
TEST(Test.TEST);
private final Test test;
Test(Test test) {
this.test = test;
}
public Test getTest() {
return test;
}
}
That's a lot of test
Then you'll need to make each of your GUIs implement InventoryHolder and check that the clicked inventory is an instance of that specific GUI. @pastel condor
Should theoretically be null though

Lmao
Very much NOT exciting
wat
like this? GUI gui = new GUI(); Inventory inv = Bukkit.createInventory(gui, 36, "Help"); then ```public class GUI implements Listener, InventoryHolder {
@EventHandler
public void gui (InventoryClickEvent event) {
SlimePlugin SPlugin = (SlimePlugin) Bukkit.getPluginManager().getPlugin("SlimeWorldManager");
SlimeLoader loader = SPlugin.getLoader("file");
final Player player = (Player) event.getWhoClicked();
if (event.getInventory().getHolder() != this) return;
//event.setCancelled(true);
final ItemStack clickedItem = event.getCurrentItem();
// verify current item is not null
if (clickedItem == null || clickedItem.getType() == Material.AIR) return;
final Player p = (Player) event.getWhoClicked();
// Using slots click is a best option for your inventory click's
p.sendMessage("You clicked at slot " + event.getRawSlot());
if (event.getRawSlot() == 11) {
try {
if (loader.worldExists(player.getUniqueId().toString())) {
player.performCommand("fbt tp");
} else {
player.performCommand("fbt cw");
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
//more slots
}
@Override
public Inventory getInventory() {
// TODO Auto-generated method stub
return null;
}
}
is that a joke
what?
how would you do TEST.test
if theres no object initialized
lol
I heard you like enums, so here's an enum referencing itself in an enum
TEST.test.getTest().getTest().getTest().getTest().getTest()...repeat forever
@pastel condor I'm not sure but... I think it should be if (!event.getInventory().getHolder() instanceof GUI) return; instead of != this
enum Bhoolean {
TRUE(Bhoolean.FALSE),
FALSE(Bhoolean.TRUE);
private final Bhoolean negation;
Bhoolean(Bhoolean negation) {
this.negation = negation;
}
public Bhoolean getNegation() {
return negation;
}
}
yikes
i'm betting that FALSE.getNegation() will be true but TRUE.getNegation() will be null
Good job making booleans work inversely.
it returns @radiant pollen
Yeah that's what I did right?
Sure
if (!event.getInventory().getHolder() instanceof GUI) return;
just stop
you did that
you're driving me crazy
shouldn't it be if (!event.getInventory().getHolder() !instanceof GUI) return;
oh
I see
nm
what the
I didn't see the ! at the start
it should be (!(instanceof here))
too many brackets
honestly !null should be true
...
then Bhooleans would work as trits
Oh yeah, Avro is right lol
no it's a Bhoolean
should call it Bfooleans
.
He's talking about something completely different @pastel condor
oh xD
yeah
Bhoolean
ONE(Integereger.ONE);
private Integereger integereger;
Integereger(Integereger integereger) {
this.integereger = integereger;
}
public Integereger getIntegereger() {
return integereger;
}
}```
am doin it rite?
Now I can steal items from my gui though
h i l a r i o u s
how do I stop that?
Cancel the click event?
event.setCancelled(true) is a godsend
but if I shift click the dirt block it still lets me steal
are you cancelling every click on any item?
yeah
it lets you shift click it out of the gui or into the gui
out
wait im confused by my own question
you can put stuff in the gui?
or take stuff out
take stuff out
oh
can i see your code?
sure
import java.io.IOException;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import com.grinderwolf.swm.api.SlimePlugin;
import com.grinderwolf.swm.api.loaders.SlimeLoader;
public class GUI implements Listener, InventoryHolder {
@EventHandler
public void gui (InventoryClickEvent event) {
SlimePlugin SPlugin = (SlimePlugin) Bukkit.getPluginManager().getPlugin("SlimeWorldManager");
SlimeLoader loader = SPlugin.getLoader("file");
final Player player = (Player) event.getWhoClicked();
if (!(event.getInventory().getHolder() instanceof GUI)) return;
event.setCancelled(true);
final ItemStack clickedItem = event.getCurrentItem();
// verify current item is not null
if (clickedItem == null || clickedItem.getType() == Material.AIR) return;
final Player p = (Player) event.getWhoClicked();
if (event.getRawSlot() == 11) {
try {
if (loader.worldExists(player.getUniqueId().toString())) {
player.performCommand("fbt tp");
} else {
player.performCommand("fbt cw");
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
//more slots
}
@Override
public Inventory getInventory() {
// TODO Auto-generated method stub
return null;
}
}
idk
so you should have to cancel that out too
why did you override #getInventory() ?
extends Event
implements Cancellable
Called when some entity or block (e.g. hopper) tries to move items directly from one inventory to another.
When this event is called, the initiator may already have removed the item from the source inventory and is ready to move it into the destination inventory.
If this event is cancelled, the items will be returned to the source inventory, if needed.
If this event is not cancelled, the initiator will try to put the ItemStack into the destination inventory. If this is not possible and the ItemStack has not been modified, the source inventory slot will be restored to its former state. Otherwise any additional items will be discarded.```
@fluid bloom he implements inventory holder
oh
which is an interface with that method
oh thanks
works?
but how do I make it so it's not always running on all inventories
event.getInventory() dosen't work
guys, inventoryholder shouldn't be implemented....
you can add a boolean to verify if the player opened a GUI Inventory
eclipse told me to implement it
would this work? public void preventShiftgui (InventoryMoveItemEvent event) { if (!(((HumanEntity) event).getInventory().getHolder() instanceof GUI)) return; event.setCancelled(true); }
There is no getInventory() function
casting event to HumanEntity
but I need to check if they grabbed the item from my gui or from a chest
I shouldn't cancel everthing
yeah
there is a getSource()