Compare commits
4 Commits
d9afdeb4cd
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| e78d65d9b1 | |||
| 2bdc804f46 | |||
| e30236d281 | |||
| 043a7d0365 |
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
Effekte Challenge V2/target/*
|
||||||
|
.DS_Store
|
||||||
@@ -4,14 +4,20 @@ import org.bukkit.potion.PotionEffectType;
|
|||||||
|
|
||||||
public class Effekt {
|
public class Effekt {
|
||||||
|
|
||||||
|
private String eName;
|
||||||
private PotionEffectType ieffect;
|
private PotionEffectType ieffect;
|
||||||
private EffektTyp ieTyp;
|
private EffektTyp ieTyp;
|
||||||
|
|
||||||
public Effekt(PotionEffectType effect, EffektTyp eTyp) {
|
public Effekt(String name, PotionEffectType effect, EffektTyp eTyp) {
|
||||||
|
this.eName = name;
|
||||||
this.ieffect = effect;
|
this.ieffect = effect;
|
||||||
this.ieTyp = eTyp;
|
this.ieTyp = eTyp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return this.eName;
|
||||||
|
}
|
||||||
|
|
||||||
public PotionEffectType getEffect() {
|
public PotionEffectType getEffect() {
|
||||||
return this.ieffect;
|
return this.ieffect;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,43 +6,43 @@ import org.bukkit.potion.PotionEffectType;
|
|||||||
public abstract class EffektLibrary {
|
public abstract class EffektLibrary {
|
||||||
|
|
||||||
private static List<Effekt> effects = List.of(
|
private static List<Effekt> effects = List.of(
|
||||||
new Effekt(PotionEffectType.SPEED, EffektTyp.GOOD),
|
new Effekt("Speed", PotionEffectType.SPEED, EffektTyp.GOOD),
|
||||||
new Effekt(PotionEffectType.SLOWNESS, EffektTyp.BAD),
|
new Effekt("Slowness", PotionEffectType.SLOWNESS, EffektTyp.BAD),
|
||||||
new Effekt(PotionEffectType.JUMP_BOOST, EffektTyp.GOOD),
|
new Effekt("Jump Boost", PotionEffectType.JUMP_BOOST, EffektTyp.GOOD),
|
||||||
new Effekt(PotionEffectType.OOZING, EffektTyp.NEUTRAL),
|
new Effekt("Oozing", PotionEffectType.OOZING, EffektTyp.NEUTRAL),
|
||||||
new Effekt(PotionEffectType.FIRE_RESISTANCE, EffektTyp.GOOD),
|
new Effekt("Fire Resistance", PotionEffectType.FIRE_RESISTANCE, EffektTyp.GOOD),
|
||||||
new Effekt(PotionEffectType.INSTANT_DAMAGE, EffektTyp.BAD),
|
new Effekt("Instant Damage", PotionEffectType.INSTANT_DAMAGE, EffektTyp.BAD),
|
||||||
new Effekt(PotionEffectType.INSTANT_HEALTH, EffektTyp.GOOD),
|
new Effekt("Instant Health", PotionEffectType.INSTANT_HEALTH, EffektTyp.GOOD),
|
||||||
new Effekt(PotionEffectType.HUNGER, EffektTyp.BAD),
|
new Effekt("Hunger", PotionEffectType.HUNGER, EffektTyp.BAD),
|
||||||
new Effekt(PotionEffectType.INVISIBILITY, EffektTyp.GOOD),
|
new Effekt("Invisibility", PotionEffectType.INVISIBILITY, EffektTyp.GOOD),
|
||||||
new Effekt(PotionEffectType.LEVITATION, EffektTyp.BAD),
|
new Effekt("Levitation", PotionEffectType.LEVITATION, EffektTyp.BAD),
|
||||||
new Effekt(PotionEffectType.NIGHT_VISION, EffektTyp.GOOD),
|
new Effekt("Night Vision", PotionEffectType.NIGHT_VISION, EffektTyp.GOOD),
|
||||||
new Effekt(PotionEffectType.POISON, EffektTyp.BAD),
|
new Effekt("Poison", PotionEffectType.POISON, EffektTyp.BAD),
|
||||||
new Effekt(PotionEffectType.REGENERATION, EffektTyp.GOOD),
|
new Effekt("Regeneration", PotionEffectType.REGENERATION, EffektTyp.GOOD),
|
||||||
new Effekt(PotionEffectType.STRENGTH, EffektTyp.GOOD),
|
new Effekt("Strength", PotionEffectType.STRENGTH, EffektTyp.GOOD),
|
||||||
new Effekt(PotionEffectType.WEAKNESS, EffektTyp.BAD),
|
new Effekt("Weakness", PotionEffectType.WEAKNESS, EffektTyp.BAD),
|
||||||
new Effekt(PotionEffectType.WITHER, EffektTyp.BAD),
|
new Effekt("Wither", PotionEffectType.WITHER, EffektTyp.BAD),
|
||||||
new Effekt(PotionEffectType.INFESTED, EffektTyp.NEUTRAL),
|
new Effekt("Infested", PotionEffectType.INFESTED, EffektTyp.NEUTRAL),
|
||||||
new Effekt(PotionEffectType.HASTE, EffektTyp.GOOD),
|
new Effekt("Haste", PotionEffectType.HASTE, EffektTyp.GOOD),
|
||||||
new Effekt(PotionEffectType.MINING_FATIGUE, EffektTyp.BAD),
|
new Effekt("Mining Fatigue", PotionEffectType.MINING_FATIGUE, EffektTyp.BAD),
|
||||||
new Effekt(PotionEffectType.STRENGTH, EffektTyp.GOOD),
|
new Effekt("Strength", PotionEffectType.STRENGTH, EffektTyp.GOOD),
|
||||||
new Effekt(PotionEffectType.NAUSEA, EffektTyp.BAD),
|
new Effekt("Nausea", PotionEffectType.NAUSEA, EffektTyp.BAD),
|
||||||
new Effekt(PotionEffectType.RESISTANCE, EffektTyp.GOOD),
|
new Effekt("Resistance", PotionEffectType.RESISTANCE, EffektTyp.GOOD),
|
||||||
new Effekt(PotionEffectType.WATER_BREATHING, EffektTyp.GOOD),
|
new Effekt("Water Breathing", PotionEffectType.WATER_BREATHING, EffektTyp.GOOD),
|
||||||
new Effekt(PotionEffectType.INVISIBILITY, EffektTyp.NEUTRAL),
|
new Effekt("Invisibility", PotionEffectType.INVISIBILITY, EffektTyp.NEUTRAL),
|
||||||
new Effekt(PotionEffectType.BLINDNESS, EffektTyp.BAD),
|
new Effekt("Blindness", PotionEffectType.BLINDNESS, EffektTyp.BAD),
|
||||||
new Effekt(PotionEffectType.NIGHT_VISION, EffektTyp.NEUTRAL),
|
new Effekt("Night Vision", PotionEffectType.NIGHT_VISION, EffektTyp.NEUTRAL),
|
||||||
new Effekt(PotionEffectType.HUNGER, EffektTyp.BAD),
|
new Effekt("Hunger", PotionEffectType.HUNGER, EffektTyp.BAD),
|
||||||
new Effekt(PotionEffectType.HEALTH_BOOST, EffektTyp.GOOD),
|
new Effekt("Health Boost", PotionEffectType.HEALTH_BOOST, EffektTyp.GOOD),
|
||||||
new Effekt(PotionEffectType.ABSORPTION, EffektTyp.GOOD),
|
new Effekt("Absorption", PotionEffectType.ABSORPTION, EffektTyp.GOOD),
|
||||||
new Effekt(PotionEffectType.SATURATION, EffektTyp.GOOD),
|
new Effekt("Saturation", PotionEffectType.SATURATION, EffektTyp.GOOD),
|
||||||
new Effekt(PotionEffectType.GLOWING, EffektTyp.NEUTRAL),
|
new Effekt("Glowing", PotionEffectType.GLOWING, EffektTyp.NEUTRAL),
|
||||||
new Effekt(PotionEffectType.LUCK, EffektTyp.NEUTRAL),
|
new Effekt("Luck", PotionEffectType.LUCK, EffektTyp.NEUTRAL),
|
||||||
new Effekt(PotionEffectType.UNLUCK, EffektTyp.NEUTRAL),
|
new Effekt("Unluck", PotionEffectType.UNLUCK, EffektTyp.NEUTRAL),
|
||||||
new Effekt(PotionEffectType.CONDUIT_POWER, EffektTyp.GOOD),
|
new Effekt("Conduit Power", PotionEffectType.CONDUIT_POWER, EffektTyp.GOOD),
|
||||||
new Effekt(PotionEffectType.DOLPHINS_GRACE, EffektTyp.GOOD),
|
new Effekt("Dolphins Grace", PotionEffectType.DOLPHINS_GRACE, EffektTyp.GOOD),
|
||||||
new Effekt(PotionEffectType.BAD_OMEN, EffektTyp.BAD),
|
new Effekt("Bad Omen", PotionEffectType.BAD_OMEN, EffektTyp.BAD),
|
||||||
new Effekt(PotionEffectType.HERO_OF_THE_VILLAGE, EffektTyp.GOOD));
|
new Effekt("Hero of the Village", PotionEffectType.HERO_OF_THE_VILLAGE, EffektTyp.GOOD));
|
||||||
|
|
||||||
public static List<Effekt> getEffects() {
|
public static List<Effekt> getEffects() {
|
||||||
return effects;
|
return effects;
|
||||||
@@ -55,5 +55,4 @@ public abstract class EffektLibrary {
|
|||||||
public static int getEffectCount() {
|
public static int getEffectCount() {
|
||||||
return effects.size();
|
return effects.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -9,11 +9,13 @@ public class EffektRevolver {
|
|||||||
private int roundsShot;
|
private int roundsShot;
|
||||||
private boolean isEmpty;
|
private boolean isEmpty;
|
||||||
private ArrayList<Effekt> chamber = new ArrayList<Effekt>();
|
private ArrayList<Effekt> chamber = new ArrayList<Effekt>();
|
||||||
|
private String chamberIndicator;
|
||||||
|
|
||||||
public EffektRevolver(int roundSlots) {
|
public EffektRevolver(int roundSlots) {
|
||||||
this.roundSlots = roundSlots;
|
this.roundSlots = roundSlots;
|
||||||
this.roundsShot = 0;
|
this.roundsShot = 0;
|
||||||
this.isEmpty = true;
|
this.isEmpty = true;
|
||||||
|
this.chamberIndicator = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadRevolver() {
|
public void loadRevolver() {
|
||||||
@@ -25,6 +27,7 @@ public class EffektRevolver {
|
|||||||
|
|
||||||
for (int i = 0; i < EffektLibrary.getEffectCount(); i++) {
|
for (int i = 0; i < EffektLibrary.getEffectCount(); i++) {
|
||||||
randomZahlen.add(i);
|
randomZahlen.add(i);
|
||||||
|
this.chamberIndicator += "§7| ";
|
||||||
}
|
}
|
||||||
|
|
||||||
Collections.shuffle(randomZahlen);
|
Collections.shuffle(randomZahlen);
|
||||||
@@ -34,15 +37,24 @@ public class EffektRevolver {
|
|||||||
}
|
}
|
||||||
this.isEmpty = false;
|
this.isEmpty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Effekt shoot() {
|
public Effekt shoot() {
|
||||||
if (!this.isEmpty && this.roundsShot < this.roundSlots) {
|
if (this.roundsShot <= this.roundSlots) {
|
||||||
int chamberNumber = this.roundsShot;
|
int chamberNumber = this.roundsShot;
|
||||||
this.roundsShot++;
|
this.roundsShot++;
|
||||||
|
this.chamberIndicator = this.chamberIndicator.substring(0, this.chamberIndicator.length() - 4);
|
||||||
return this.chamber.get(chamberNumber);
|
return this.chamber.get(chamberNumber);
|
||||||
}
|
}
|
||||||
|
this.isEmpty = true;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return this.isEmpty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getChamberIndicator() {
|
||||||
|
return this.chamberIndicator;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
package com.xonics.ef.classes;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.boss.BossBar;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.boss.BarColor;
|
||||||
|
import org.bukkit.boss.BarStyle;
|
||||||
|
import com.xonics.ef.main;
|
||||||
|
|
||||||
|
public class EffekteChallenge {
|
||||||
|
private static boolean isRunning;
|
||||||
|
private List<Player> players;
|
||||||
|
private BukkitRunnable task;
|
||||||
|
private TimeManager tm;
|
||||||
|
|
||||||
|
public EffekteChallenge(List<Player> participants, int timer) {
|
||||||
|
this.players = participants;
|
||||||
|
isRunning = false;
|
||||||
|
this.tm.setTime(timer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EffekteChallenge(List<Player> participants) {
|
||||||
|
this(participants, 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void start() {
|
||||||
|
if (!isRunning) {
|
||||||
|
isRunning = true;
|
||||||
|
BossBar infoBar = Bukkit.createBossBar("Finger an der Gapling Gan", BarColor.RED, BarStyle.SEGMENTED_10);
|
||||||
|
for (Player p : players) {
|
||||||
|
infoBar.addPlayer(p);
|
||||||
|
infoBar.setVisible(true);
|
||||||
|
}
|
||||||
|
Timer.start();
|
||||||
|
EffektRevolver revolver = new EffektRevolver(6);
|
||||||
|
revolver.loadRevolver();
|
||||||
|
this.task = new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
|
||||||
|
infoBar.setTitle(
|
||||||
|
"Finger an der Gapling Gan in " + tm.getTime() + "s " + revolver.getChamberIndicator());
|
||||||
|
infoBar.setProgress((double) (tm.getInitTime() - tm.getTime()) / tm.getInitTime());
|
||||||
|
|
||||||
|
if (tm.getTime() == 0) {
|
||||||
|
if (!revolver.isEmpty()) {
|
||||||
|
setEffekt(revolver.shoot());
|
||||||
|
} else {
|
||||||
|
revolver.loadRevolver();
|
||||||
|
}
|
||||||
|
tm.resetTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
tm.decreaseTime();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
task.runTaskTimer(main.getInstance(), 0L, 20L);
|
||||||
|
} else {
|
||||||
|
Bukkit.broadcastMessage("§cDie Challenge läuft bereits!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stop() {
|
||||||
|
this.task.cancel();
|
||||||
|
isRunning = false;
|
||||||
|
Timer.stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendMessageToParticipants(String msg) {
|
||||||
|
for (Player p : players) {
|
||||||
|
p.sendMessage(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEffekt(Effekt e) {
|
||||||
|
for (Player p : players) {
|
||||||
|
p.addPotionEffect(new PotionEffect(e.getEffect(), tm.getInitTime(), 1));
|
||||||
|
switch (e.getEffektTyp()) {
|
||||||
|
case GOOD:
|
||||||
|
p.sendTitle("§a" + e.getName(), "", 10, 20, 10);
|
||||||
|
break;
|
||||||
|
case BAD:
|
||||||
|
p.sendTitle("§c" + e.getName(), "", 10, 20, 10);
|
||||||
|
break;
|
||||||
|
case NEUTRAL:
|
||||||
|
p.sendTitle("§7" + e.getName(), "", 10, 20, 10);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isRunning() {
|
||||||
|
return isRunning;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.xonics.ef.classes;
|
||||||
|
|
||||||
|
public class TimeManager {
|
||||||
|
private int time;
|
||||||
|
private int timeClone;
|
||||||
|
|
||||||
|
public void setTime(int time) {
|
||||||
|
this.time = time;
|
||||||
|
this.timeClone = time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decreaseTime() {
|
||||||
|
this.time--;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void increaseTime() {
|
||||||
|
this.time++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTime() {
|
||||||
|
return this.time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getInitTime() {
|
||||||
|
return this.timeClone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetTime() {
|
||||||
|
this.time = this.timeClone;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,16 +7,18 @@ import net.md_5.bungee.api.chat.TextComponent;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class Timer {
|
public abstract class Timer {
|
||||||
|
|
||||||
private static int time;
|
private static int time;
|
||||||
private static BukkitRunnable task;
|
private static BukkitRunnable task;
|
||||||
private static boolean paused = false;
|
private static boolean paused = false;
|
||||||
|
private static boolean running = false;
|
||||||
|
|
||||||
public static void start() {
|
public static void start() {
|
||||||
if (task != null)
|
if (task != null)
|
||||||
return;
|
return;
|
||||||
time = 0;
|
time = 0;
|
||||||
|
running = true;
|
||||||
|
|
||||||
task = new BukkitRunnable() {
|
task = new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
@@ -53,6 +55,7 @@ public class Timer {
|
|||||||
task = null;
|
task = null;
|
||||||
time = 0;
|
time = 0;
|
||||||
paused = false;
|
paused = false;
|
||||||
|
running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getTime() {
|
public static String getTime() {
|
||||||
@@ -61,4 +64,12 @@ public class Timer {
|
|||||||
int sekunden = time % 60;
|
int sekunden = time % 60;
|
||||||
return String.format("%02d:%02d:%02d", stunden, minuten, sekunden);
|
return String.format("%02d:%02d:%02d", stunden, minuten, sekunden);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isPaused() {
|
||||||
|
return paused;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isRunning() {
|
||||||
|
return running;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.xonics.ef.commands;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import com.xonics.ef.classes.EffekteChallenge;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ChallengeCommands implements CommandExecutor {
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
|
int effektcooldown = 0;
|
||||||
|
if (args.length > 0) {
|
||||||
|
try {
|
||||||
|
effektcooldown = Integer.parseInt(args[0]);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
sender.sendMessage(args[0] + " ist keine gültige Zahl!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<Player> players = new ArrayList<Player>();
|
||||||
|
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||||
|
players.add(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
EffekteChallenge challenge = new EffekteChallenge(players, effektcooldown);
|
||||||
|
|
||||||
|
switch (command.getName().toLowerCase()) {
|
||||||
|
case "start":
|
||||||
|
if (EffekteChallenge.isRunning()) {
|
||||||
|
sender.sendMessage("§cDas Challenge läuft bereits!");
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
challenge.start();
|
||||||
|
sender.sendMessage("Die Challenge wurde gestartet.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
case "stop":
|
||||||
|
if (!EffekteChallenge.isRunning()) {
|
||||||
|
sender.sendMessage("§cDie Challenge läuft nicht!");
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
challenge.stop();
|
||||||
|
challenge = null;
|
||||||
|
sender.sendMessage("Die Challenge wurde gestoppt.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.xonics.ef.commands;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import com.xonics.ef.classes.Timer;
|
||||||
|
|
||||||
|
public class TimerCommands implements CommandExecutor {
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
|
Player p = (Player) sender;
|
||||||
|
|
||||||
|
switch (command.getName().toLowerCase()) {
|
||||||
|
case "pause":
|
||||||
|
if (Timer.isPaused()) {
|
||||||
|
p.sendMessage("Der Timer ist bereits pausiert.");
|
||||||
|
} else {
|
||||||
|
Timer.pause();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "resume":
|
||||||
|
if (!Timer.isPaused()) {
|
||||||
|
p.sendMessage("Der Timer läuft bereits.");
|
||||||
|
} else {
|
||||||
|
Timer.resume();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,12 +3,19 @@ package com.xonics.ef.listeners;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
public class PlayerListener implements Listener {
|
public class PlayerListener implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
String pName = event.getPlayer().getName();
|
String pName = event.getPlayer().getName();
|
||||||
event.setJoinMessage("§a" + pName + " §7ist dem Spiel beigetreten!");
|
event.setJoinMessage("§a+ §8| §7" + pName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void OnPlayerLeave(PlayerQuitEvent event) {
|
||||||
|
String pName = event.getPlayer().getName();
|
||||||
|
event.setQuitMessage("§c- §8| §7" + pName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,8 @@ package com.xonics.ef;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import com.xonics.ef.managers.PluginManager;
|
import com.xonics.ef.managers.PluginManager;
|
||||||
import com.xonics.ef.listeners.PlayerListener;
|
import com.xonics.ef.listeners.PlayerListener;
|
||||||
|
import com.xonics.ef.commands.ChallengeCommands;
|
||||||
|
import com.xonics.ef.commands.TimerCommands;
|
||||||
|
|
||||||
public class main extends JavaPlugin {
|
public class main extends JavaPlugin {
|
||||||
|
|
||||||
@@ -23,6 +25,12 @@ public class main extends JavaPlugin {
|
|||||||
// Register listeners
|
// Register listeners
|
||||||
getServer().getPluginManager().registerEvents(new PlayerListener(), this);
|
getServer().getPluginManager().registerEvents(new PlayerListener(), this);
|
||||||
|
|
||||||
|
// Register commands
|
||||||
|
getCommand("pause").setExecutor(new TimerCommands());
|
||||||
|
getCommand("resume").setExecutor(new TimerCommands());
|
||||||
|
getCommand("start").setExecutor(new ChallengeCommands());
|
||||||
|
getCommand("stop").setExecutor(new ChallengeCommands());
|
||||||
|
|
||||||
getLogger().info("Effekte Challenge V2 has been enabled!");
|
getLogger().info("Effekte Challenge V2 has been enabled!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,4 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
return ChatColor.translateAlternateColorCodes('&', msg);
|
return ChatColor.translateAlternateColorCodes('&', msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add more utility methods here
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,14 @@
|
|||||||
main: com.xonics.ef.main
|
main: com.xonics.ef.main
|
||||||
version: 1.0.0-SNAPSHOT
|
version: 12.0.1
|
||||||
name: Effekte
|
name: Effekte
|
||||||
author: xonics
|
author: xonics
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
|
commands:
|
||||||
|
pause:
|
||||||
|
description: Pauses the timer
|
||||||
|
usage: /pause
|
||||||
|
permission: timer.pause
|
||||||
|
resume:
|
||||||
|
description: Resumes the timer
|
||||||
|
usage: /resume
|
||||||
|
permission: timer.resume
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,5 +0,0 @@
|
|||||||
main: com.xonics.ef.main
|
|
||||||
version: 1.0.0-SNAPSHOT
|
|
||||||
name: Effekte
|
|
||||||
author: xonics
|
|
||||||
api-version: 1.13
|
|
||||||
Reference in New Issue
Block a user