Skip to content

Commit

Permalink
✨ add spawn command
Browse files Browse the repository at this point in the history
  • Loading branch information
jerembdn committed Jan 17, 2024
1 parent 3a48fa1 commit 6836317
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 7 deletions.
10 changes: 5 additions & 5 deletions .settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
arguments=
arguments=--init-script /home/jijon/.vscode-server/data/User/globalStorage/stripe.vscode-stripe/2.0.14/config_linux/org.eclipse.osgi/51/0/.cp/gradle/init/init.gradle --init-script /home/jijon/.vscode-server/data/User/globalStorage/stripe.vscode-stripe/2.0.14/config_linux/org.eclipse.osgi/51/0/.cp/gradle/protobuf/init.gradle
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
java.home=
java.home=/usr/lib/jvm/java-17-openjdk-amd64
jvm.arguments=
offline.mode=false
override.workspace.settings=false
show.console.view=false
show.executions.view=false
override.workspace.settings=true
show.console.view=true
show.executions.view=true
Binary file modified bin/main/fr/thegreensuits/viewing_party/Main.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
8 changes: 7 additions & 1 deletion bin/main/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@ version: "1.0"
main: fr.thegreensuits.viewing_party.Main

api: "1.18.2"
api-version: 1.18
api-version: 1.18

commands:
spawn:
description: Se téléporter au point d'apparition
usage: /<command>
aliases: [hub, lobby]
5 changes: 5 additions & 0 deletions src/main/java/fr/thegreensuits/viewing_party/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.bukkit.plugin.java.JavaPlugin;

import fr.thegreensuits.viewing_party.command.CommandSpawn;
import fr.thegreensuits.viewing_party.listener.AsyncPlayerChatListener;
import fr.thegreensuits.viewing_party.listener.EntityDamageListener;
import fr.thegreensuits.viewing_party.listener.PlayerInteractAtEntityListener;
Expand All @@ -19,12 +20,16 @@ public Main() {
public void onEnable() {
super.onEnable();

// - Register listeners
getServer().getPluginManager().registerEvents(new PlayerJoinListener(), INSTANCE);
getServer().getPluginManager().registerEvents(new PlayerQuitListener(), INSTANCE);
getServer().getPluginManager().registerEvents(new AsyncPlayerChatListener(), INSTANCE);
getServer().getPluginManager().registerEvents(new EntityDamageListener(), INSTANCE);
getServer().getPluginManager().registerEvents(new PlayerInteractAtEntityListener(), INSTANCE);

// - Register commands
getCommand("spawn").setExecutor(new CommandSpawn());

getLogger().info("ViewingParty plugin enabled");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package fr.thegreensuits.viewing_party.command;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class CommandSpawn implements CommandExecutor {

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(!(sender instanceof Player)) return false;

Player player = (Player) sender;

player.teleport(player.getWorld().getSpawnLocation());
player.sendMessage("§5Vous avez été téléporté au point d'apparition.");

return true;
}
}
8 changes: 7 additions & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@ version: "1.0"
main: fr.thegreensuits.viewing_party.Main

api: "1.18.2"
api-version: 1.18
api-version: 1.18

commands:
spawn:
description: Se téléporter au point d'apparition
usage: /<command>
aliases: [hub, lobby]

0 comments on commit 6836317

Please sign in to comment.