Compare commits
No commits in common. "d0e6f470c852e4e654504b2a2a17d10169896f12" and "6cb0f04170530fd6e3b1f79f838b55254d7574bb" have entirely different histories.
d0e6f470c8
...
6cb0f04170
4 changed files with 1 additions and 92 deletions
|
@ -1,5 +1,5 @@
|
||||||
group = "rip.iwakura"
|
group = "rip.iwakura"
|
||||||
version = "2.1.1"
|
version = "0.1.0"
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
java
|
java
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
version: '3'
|
|
||||||
services:
|
|
||||||
civil_test_db:
|
|
||||||
environment:
|
|
||||||
- POSTGRES_PASSWORD=TEST123
|
|
||||||
image: docker.io/postgres:16.3
|
|
||||||
ports:
|
|
||||||
- 127.0.0.1:5432:5432
|
|
|
@ -5,7 +5,6 @@ import java.util.ArrayList;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
@ -22,7 +21,6 @@ import net.kyori.adventure.text.format.TextDecoration;
|
||||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||||
import rip.iwakura.civil.events.ChatHandler;
|
import rip.iwakura.civil.events.ChatHandler;
|
||||||
import rip.iwakura.civil.events.TeamChatHandler;
|
import rip.iwakura.civil.events.TeamChatHandler;
|
||||||
import rip.iwakura.civil.commands.Spawn;
|
|
||||||
import rip.iwakura.civil.commands.Team;
|
import rip.iwakura.civil.commands.Team;
|
||||||
import rip.iwakura.civil.events.JoinHandler;
|
import rip.iwakura.civil.events.JoinHandler;
|
||||||
import rip.iwakura.civil.types.CivilPlayer;
|
import rip.iwakura.civil.types.CivilPlayer;
|
||||||
|
@ -73,13 +71,6 @@ public class Core extends JavaPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getSpawn() {
|
|
||||||
return new Location(Bukkit.getWorld(getConfig().getString("spawn.world")),
|
|
||||||
getConfig().getDouble("spawn.x"), getConfig().getDouble("spawn.y"),
|
|
||||||
getConfig().getDouble("spawn.z"), (float) getConfig().getDouble("spawn.yaw"),
|
|
||||||
(float) getConfig().getDouble("spawn.pitch"));
|
|
||||||
};
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
getLogger().info("Hello world! We are booting up...");
|
getLogger().info("Hello world! We are booting up...");
|
||||||
|
@ -99,11 +90,9 @@ public class Core extends JavaPlugin {
|
||||||
discord.connect(getConfig().getString("discord.token"));
|
discord.connect(getConfig().getString("discord.token"));
|
||||||
|
|
||||||
Team teamCommand = new Team(this);
|
Team teamCommand = new Team(this);
|
||||||
Spawn spawnCommand = new Spawn(this);
|
|
||||||
|
|
||||||
this.getLifecycleManager().registerEventHandler(LifecycleEvents.COMMANDS, commands -> {
|
this.getLifecycleManager().registerEventHandler(LifecycleEvents.COMMANDS, commands -> {
|
||||||
commands.registrar().register(teamCommand.getCommand());
|
commands.registrar().register(teamCommand.getCommand());
|
||||||
commands.registrar().register(spawnCommand.getCommand());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
getServer().getPluginManager().registerEvents(new JoinHandler(database), this);
|
getServer().getPluginManager().registerEvents(new JoinHandler(database), this);
|
||||||
|
|
|
@ -1,72 +0,0 @@
|
||||||
package rip.iwakura.civil.commands;
|
|
||||||
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.text.Format;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.checkerframework.common.reflection.qual.GetConstructor;
|
|
||||||
|
|
||||||
import com.mojang.brigadier.Command;
|
|
||||||
import com.mojang.brigadier.arguments.LongArgumentType;
|
|
||||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
|
||||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
|
||||||
import com.mojang.brigadier.tree.LiteralCommandNode;
|
|
||||||
|
|
||||||
import io.papermc.paper.command.brigadier.CommandSourceStack;
|
|
||||||
import io.papermc.paper.command.brigadier.Commands;
|
|
||||||
import net.kyori.adventure.text.Component;
|
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
|
||||||
import net.kyori.adventure.text.format.TextDecoration;
|
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
|
||||||
import net.kyori.adventure.text.minimessage.translation.MiniMessageTranslator;
|
|
||||||
import rip.iwakura.civil.Core;
|
|
||||||
import rip.iwakura.civil.Database;
|
|
||||||
import rip.iwakura.civil.exceptions.InvalidChannelException;
|
|
||||||
import rip.iwakura.civil.types.*;
|
|
||||||
|
|
||||||
public class Spawn {
|
|
||||||
private Core core;
|
|
||||||
|
|
||||||
public Spawn(Core core) {
|
|
||||||
this.core = core;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LiteralCommandNode<CommandSourceStack> getCommand() {
|
|
||||||
return Commands.literal("spawn")
|
|
||||||
.requires(ctx -> ctx.getSender() instanceof Player)
|
|
||||||
.executes(ctx -> {
|
|
||||||
Player p = (Player) ctx.getSource().getSender();
|
|
||||||
|
|
||||||
if (!core.getConfig().contains("spawn")) {
|
|
||||||
p.sendMessage(MiniMessage.miniMessage().deserialize("<red>The spawn has not been set yet."));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.teleport(core.getSpawn());
|
|
||||||
|
|
||||||
return Command.SINGLE_SUCCESS;
|
|
||||||
})
|
|
||||||
.then(Commands.literal("set").requires(
|
|
||||||
ctx -> ctx.getSender() instanceof Player && ctx.getSender().hasPermission("civil.spawn.set"))
|
|
||||||
.executes(ctx -> {
|
|
||||||
Player p = (Player) ctx.getSource().getSender();
|
|
||||||
Location loc = p.getLocation();
|
|
||||||
|
|
||||||
core.getConfig().set("spawn.world", loc.getWorld().getName());
|
|
||||||
core.getConfig().set("spawn.x", loc.x());
|
|
||||||
core.getConfig().set("spawn.y", loc.y());
|
|
||||||
core.getConfig().set("spawn.z", loc.z());
|
|
||||||
core.getConfig().set("spawn.yaw", loc.getYaw());
|
|
||||||
core.getConfig().set("spawn.pitch", loc.getPitch());
|
|
||||||
|
|
||||||
p.sendMessage(MiniMessage.miniMessage().deserialize("<green>Set the server spawn to your current position."));
|
|
||||||
|
|
||||||
return Command.SINGLE_SUCCESS;
|
|
||||||
}))
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue