some Testing with Blockdisplays
This commit is contained in:
parent
6ac894f748
commit
44adb56903
1
.idea/modules.xml
generated
1
.idea/modules.xml
generated
@ -3,6 +3,7 @@
|
|||||||
<component name="ProjectModuleManager">
|
<component name="ProjectModuleManager">
|
||||||
<modules>
|
<modules>
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/PixelBlocks.main.iml" filepath="$PROJECT_DIR$/.idea/modules/PixelBlocks.main.iml" />
|
<module fileurl="file://$PROJECT_DIR$/.idea/modules/PixelBlocks.main.iml" filepath="$PROJECT_DIR$/.idea/modules/PixelBlocks.main.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/modules/eu.mhsl.minecraft.PixelBlocks.main.iml" filepath="$PROJECT_DIR$/.idea/modules/eu.mhsl.minecraft.PixelBlocks.main.iml" />
|
||||||
</modules>
|
</modules>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
4
.idea/modules/PixelBlocks.main.iml
generated
4
.idea/modules/PixelBlocks.main.iml
generated
@ -11,4 +11,8 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
</facet>
|
</facet>
|
||||||
</component>
|
</component>
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
</module>
|
</module>
|
14
.idea/modules/eu.mhsl.minecraft.PixelBlocks.main.iml
generated
Normal file
14
.idea/modules/eu.mhsl.minecraft.PixelBlocks.main.iml
generated
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module version="4">
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="minecraft" name="Minecraft">
|
||||||
|
<configuration>
|
||||||
|
<autoDetectTypes>
|
||||||
|
<platformType>PAPER</platformType>
|
||||||
|
<platformType>ADVENTURE</platformType>
|
||||||
|
</autoDetectTypes>
|
||||||
|
<projectReimportVersion>1</projectReimportVersion>
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
|
</module>
|
47
src/main/java/commands/ChessCommand.java
Normal file
47
src/main/java/commands/ChessCommand.java
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
package commands;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.BlockDisplay;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public class ChessCommand implements CommandExecutor {
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
|
if(sender instanceof Player p) {
|
||||||
|
Location playerLocation = p.getLocation();
|
||||||
|
|
||||||
|
for (int i = 0; i < 8; i++) {
|
||||||
|
int finalI = i+1;
|
||||||
|
for (int j = 0; j < 8; j++) {
|
||||||
|
int finalJ = j+1;
|
||||||
|
p.getWorld().spawn(
|
||||||
|
new Location(p.getWorld(),
|
||||||
|
playerLocation.x()+i,
|
||||||
|
playerLocation.y(),
|
||||||
|
playerLocation.z()+j),
|
||||||
|
BlockDisplay.class, blockDisplay -> {
|
||||||
|
if(finalI % 2 == 0 && finalJ % 2 == 0) {
|
||||||
|
blockDisplay.setBlock(Material.BLACK_CONCRETE.createBlockData());
|
||||||
|
} else if(finalI % 2 != 0 && finalJ % 2 != 0) {
|
||||||
|
blockDisplay.setBlock(Material.BLACK_CONCRETE.createBlockData());
|
||||||
|
} else {
|
||||||
|
blockDisplay.setBlock(Material.WHITE_CONCRETE.createBlockData());
|
||||||
|
}
|
||||||
|
blockDisplay.setDisplayHeight(0.5f);
|
||||||
|
blockDisplay.setDisplayWidth(0.5f);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,11 @@
|
|||||||
package eu.mhsl.minecraft.pixelblocks;
|
package eu.mhsl.minecraft.pixelblocks;
|
||||||
|
|
||||||
|
import commands.ChessCommand;
|
||||||
|
import listeners.PlayerJumpListener;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public final class PixelBlocks extends JavaPlugin {
|
public final class PixelBlocks extends JavaPlugin {
|
||||||
public static PixelBlocks plugin;
|
public static PixelBlocks plugin;
|
||||||
|
|
||||||
@ -9,6 +13,8 @@ public final class PixelBlocks extends JavaPlugin {
|
|||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
PixelBlocks.plugin = this;
|
PixelBlocks.plugin = this;
|
||||||
this.getLogger().info("Hello World");
|
this.getLogger().info("Hello World");
|
||||||
|
getServer().getPluginManager().registerEvents(new PlayerJumpListener(), this);
|
||||||
|
Objects.requireNonNull(getCommand("chess")).setExecutor(new ChessCommand());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
12
src/main/java/listeners/PlayerJoinListener.java
Normal file
12
src/main/java/listeners/PlayerJoinListener.java
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package listeners;
|
||||||
|
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
|
||||||
|
public class PlayerJoinListener implements Listener {
|
||||||
|
@EventHandler
|
||||||
|
static void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
17
src/main/java/listeners/PlayerJumpListener.java
Normal file
17
src/main/java/listeners/PlayerJumpListener.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package listeners;
|
||||||
|
|
||||||
|
import com.destroystokyo.paper.event.player.PlayerJumpEvent;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.BlockDisplay;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
|
public class PlayerJumpListener implements Listener {
|
||||||
|
@EventHandler
|
||||||
|
static void onPlayerJump(PlayerJumpEvent event) {
|
||||||
|
event.getPlayer().getWorld().spawn(event.getPlayer().getLocation(), BlockDisplay.class, blockDisplay -> {
|
||||||
|
blockDisplay.setBlock(Material.OAK_LOG.createBlockData());
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -2,3 +2,5 @@ name: PixelBlocks
|
|||||||
version: '${version}'
|
version: '${version}'
|
||||||
main: eu.mhsl.minecraft.pixelblocks.PixelBlocks
|
main: eu.mhsl.minecraft.pixelblocks.PixelBlocks
|
||||||
api-version: '1.21'
|
api-version: '1.21'
|
||||||
|
commands:
|
||||||
|
chess:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user