Skip to content

Commit

Permalink
CS-2 updated source to match new version
Browse files Browse the repository at this point in the history
  • Loading branch information
Relluem94 committed Jun 16, 2023
1 parent cb0672d commit 0f5cc56
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 55 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
package de.relluem94.capturespleef.listener;

import static de.relluem94.capturespleef.CaptureSpleef.old;
import static de.relluem94.capturespleef.CaptureSpleef.reset;
import static de.relluem94.capturespleef.CaptureSpleef.sboard;
import static de.relluem94.capturespleef.CaptureSpleef.teams;
import static de.relluem94.capturespleef.Strings.ACTIVE_WORLD;
import static de.relluem94.capturespleef.Strings.CS_NAME;
import static de.relluem94.capturespleef.Strings.PLUGIN_PREFIX;
import static de.relluem94.capturespleef.Strings.TEAM_BLUE_NAME;
import static de.relluem94.capturespleef.Strings.TEAM_RED_NAME;
import static de.relluem94.minecraft.server.spigot.essentials.Strings.PLUGIN_FORMS_SPACER_MESSAGE;

import java.util.Random;

import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.Effect;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.EntityType;
Expand All @@ -20,17 +31,6 @@
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.inventory.meta.FireworkMeta;

import static de.relluem94.capturespleef.Strings.TEAM_RED_NAME;
import static de.relluem94.capturespleef.Strings.TEAM_BLUE_NAME;
import static de.relluem94.capturespleef.CaptureSpleef.old;
import static de.relluem94.capturespleef.CaptureSpleef.reset;
import static de.relluem94.capturespleef.CaptureSpleef.sboard;
import static de.relluem94.capturespleef.CaptureSpleef.teams;
import static de.relluem94.capturespleef.Strings.ACTIVE_WORLD;
import static de.relluem94.capturespleef.Strings.CS_NAME;
import static de.relluem94.capturespleef.Strings.PLUGIN_PREFIX;

import static de.relluem94.minecraft.server.spigot.essentials.Strings.PLUGIN_SPACER;
import de.relluem94.minecraft.server.spigot.essentials.permissions.Groups;
import de.relluem94.minecraft.server.spigot.essentials.permissions.Permission;

Expand All @@ -46,10 +46,10 @@ private void teamWin(Player p, String winner) {

if (p.getCustomName().equals(TEAM_RED_NAME) && TEAM_RED_NAME.equals(winner)) {
teams.get(p).getBlock().getRelative(0, -1, 0).setType(Material.NETHER_BRICK);
p.sendMessage(PLUGIN_PREFIX + PLUGIN_SPACER + "§1Team Blau hat gewonnen");
p.sendMessage(PLUGIN_PREFIX + PLUGIN_FORMS_SPACER_MESSAGE + "1Team Blau hat gewonnen");
} else if (p.getCustomName().equals(TEAM_BLUE_NAME) && TEAM_RED_NAME.equals(winner)) {
teams.get(p).getBlock().getRelative(0, -1, 0).setType(Material.PRISMARINE);
p.sendMessage(PLUGIN_PREFIX + PLUGIN_SPACER + "§4Team Rot hat gewonnen");
p.sendMessage(PLUGIN_PREFIX + PLUGIN_FORMS_SPACER_MESSAGE + "4Team Rot hat gewonnen");
}
}

Expand Down Expand Up @@ -116,7 +116,7 @@ private void teamWins(Player p, String winner) {
teams.get(p).getBlock().getRelative(0, -1, 0).setType(Material.NETHER_BRICK);
sboard.resetScores(p);
reset();
p.sendMessage(PLUGIN_PREFIX + PLUGIN_SPACER + "§4Team Rot hat gewonnen");
p.sendMessage(PLUGIN_PREFIX + PLUGIN_FORMS_SPACER_MESSAGE + "4Team Rot hat gewonnen");
} else if (p.getCustomName().equals(TEAM_BLUE_NAME) && TEAM_RED_NAME.equals(winner)) {
p.teleport(lobby);
//
Expand Down Expand Up @@ -175,7 +175,7 @@ private void teamWins(Player p, String winner) {
teams.get(p).getBlock().getRelative(0, -1, 0).setType(Material.PRISMARINE);
teams.clear();
sboard.resetScores(p);
p.sendMessage(PLUGIN_PREFIX + PLUGIN_SPACER + "§1Team Blau hat gewonnen");
p.sendMessage(PLUGIN_PREFIX + PLUGIN_FORMS_SPACER_MESSAGE + "1Team Blau hat gewonnen");
}
}

Expand Down Expand Up @@ -214,7 +214,7 @@ public void gameItSelf(BlockDamageEvent ev) {
ev.getBlock().setType(Material.PRISMARINE);
break;
default:
// Keine Anderen Blöcke können zerstört werden
// Keine Anderen Bl�cke k�nnen zerst�rt werden
ev.setCancelled(true);
break;
}
Expand Down Expand Up @@ -251,7 +251,7 @@ public void gameItSelf(BlockDamageEvent ev) {
ev.getBlock().setType(Material.NETHER_BRICK);
break;
default:
// Keine Anderen Blöcke können zerstört werden
// Keine Anderen Bl�cke k�nnen zerst�rt werden
ev.setCancelled(true);
break;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
package de.relluem94.capturespleef.listener;

import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;

import static de.relluem94.capturespleef.Strings.TEAM_RED_NAME;
import static de.relluem94.capturespleef.Strings.TEAM_BLUE_NAME;
import static de.relluem94.capturespleef.Strings.CS_NAME;
import static de.relluem94.capturespleef.Strings.NO_PERM;
import static de.relluem94.capturespleef.Strings.PLUGIN_PREFIX;
import static de.relluem94.capturespleef.Strings.TEAM_BLUE_NAME;
import static de.relluem94.capturespleef.Strings.TEAM_RED_NAME;
import static de.relluem94.minecraft.server.spigot.essentials.Strings.PLUGIN_FORMS_SPACER_MESSAGE;

import static de.relluem94.minecraft.server.spigot.essentials.Strings.PLUGIN_SPACER;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;

public class CSPlayerCommandPreprocess implements Listener {

Expand All @@ -22,7 +21,7 @@ public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
if (event.getMessage().toLowerCase().startsWith("/casp")) {
event.setCancelled(false);
} else {
event.getPlayer().sendMessage(PLUGIN_PREFIX + PLUGIN_SPACER + NO_PERM);
event.getPlayer().sendMessage(PLUGIN_PREFIX + PLUGIN_FORMS_SPACER_MESSAGE + NO_PERM);
event.setCancelled(true);
}
}
Expand Down
55 changes: 27 additions & 28 deletions src/main/java/de/relluem94/capturespleef/listener/CSPlayerMove.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
package de.relluem94.capturespleef.listener;

import static de.relluem94.capturespleef.CaptureSpleef.a;
import static de.relluem94.capturespleef.CaptureSpleef.b;
import static de.relluem94.capturespleef.CaptureSpleef.blau;
import static de.relluem94.capturespleef.CaptureSpleef.obj;
import static de.relluem94.capturespleef.CaptureSpleef.reset;
import static de.relluem94.capturespleef.CaptureSpleef.rot;
import static de.relluem94.capturespleef.CaptureSpleef.sboard;
import static de.relluem94.capturespleef.CaptureSpleef.teams;
import static de.relluem94.capturespleef.Strings.ACTIVE_WORLD;
import static de.relluem94.capturespleef.Strings.CS_NAME;
import static de.relluem94.capturespleef.Strings.PLUGIN_PREFIX;
import static de.relluem94.capturespleef.Strings.TEAM_BLUE_NAME;
import static de.relluem94.capturespleef.Strings.TEAM_RED_NAME;
import static de.relluem94.minecraft.server.spigot.essentials.Strings.PLUGIN_FORMS_SPACER_MESSAGE;
import static de.relluem94.minecraft.server.spigot.essentials.helpers.ChatHelper.consoleSendMessage;

import java.util.Random;

import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.EntityType;
Expand All @@ -19,23 +35,6 @@
import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.scoreboard.Score;

import static de.relluem94.capturespleef.Strings.TEAM_RED_NAME;
import static de.relluem94.capturespleef.Strings.TEAM_BLUE_NAME;
import static de.relluem94.capturespleef.CaptureSpleef.a;
import static de.relluem94.capturespleef.CaptureSpleef.b;
import static de.relluem94.capturespleef.CaptureSpleef.blau;
import static de.relluem94.capturespleef.CaptureSpleef.obj;
import static de.relluem94.capturespleef.CaptureSpleef.reset;
import static de.relluem94.capturespleef.CaptureSpleef.rot;
import static de.relluem94.capturespleef.CaptureSpleef.sboard;
import static de.relluem94.capturespleef.CaptureSpleef.teams;
import static de.relluem94.capturespleef.Strings.ACTIVE_WORLD;
import static de.relluem94.capturespleef.Strings.CS_NAME;
import static de.relluem94.capturespleef.Strings.PLUGIN_PREFIX;

import static de.relluem94.minecraft.server.spigot.essentials.Strings.PLUGIN_SPACER;
import static de.relluem94.minecraft.server.spigot.essentials.helpers.ChatHelper.consoleSendMessage;

public class CSPlayerMove implements Listener {

@EventHandler
Expand Down Expand Up @@ -69,7 +68,7 @@ public void PlayerDeath(PlayerMoveEvent evi) {
teams.get(ops).getBlock().setType(Material.AIR);
teams.get(ops).getBlock().getRelative(0, -1, 0).setType(Material.PRISMARINE);
reset();
ops.sendMessage(PLUGIN_PREFIX + PLUGIN_SPACER + " §4Team Rot hat gewonnen");
ops.sendMessage(PLUGIN_PREFIX + PLUGIN_FORMS_SPACER_MESSAGE + " 4Team Rot hat gewonnen");
}
}
} else if (b < 1) {
Expand Down Expand Up @@ -131,7 +130,7 @@ public void PlayerDeath(PlayerMoveEvent evi) {
teams.get(ops).getBlock().getRelative(0, -1, 0).setType(Material.NETHER_BRICK);
reset();
teams.clear();
ops.sendMessage(PLUGIN_PREFIX + PLUGIN_SPACER + " §4Team Rot hat gewonnen");
ops.sendMessage(PLUGIN_PREFIX + PLUGIN_FORMS_SPACER_MESSAGE + " 4Team Rot hat gewonnen");
}
}
}
Expand All @@ -156,9 +155,9 @@ public void PlayerDeath(PlayerMoveEvent evi) {
for (Player pla : Bukkit.getOnlinePlayers()) {
if (pla.getCustomName().equals(TEAM_RED_NAME) || pla.getCustomName().equals(TEAM_BLUE_NAME) || pla.getCustomName().equals(CS_NAME)) {
if (score.getScore() == 0) {
pla.sendMessage(PLUGIN_PREFIX + PLUGIN_SPACER + " §4" + TEAM_RED_NAME + " " + player.getDisplayName() + "§4 ist ausgeschieden");
pla.sendMessage(PLUGIN_PREFIX + PLUGIN_FORMS_SPACER_MESSAGE + " 4" + TEAM_RED_NAME + " " + player.getDisplayName() + "4 ist ausgeschieden");
} else {
pla.sendMessage(PLUGIN_PREFIX + PLUGIN_SPACER + " §4" + player.getCustomName() + " " + player.getDisplayName() + "§4 starb");
pla.sendMessage(PLUGIN_PREFIX + PLUGIN_FORMS_SPACER_MESSAGE + " 4" + player.getCustomName() + " " + player.getDisplayName() + "4 starb");
}
}
}
Expand Down Expand Up @@ -189,8 +188,8 @@ public void PlayerDeath(PlayerMoveEvent evi) {
teams.get(ops).getBlock().setType(Material.AIR);
reset();
teams.get(ops).getBlock().getRelative(0, -1, 0).setType(Material.PRISMARINE);
ops.sendMessage(PLUGIN_PREFIX + PLUGIN_SPACER + " §4Team Rot hat gewonnen");
consoleSendMessage("§5[Test]", "§4Rot!");
ops.sendMessage(PLUGIN_PREFIX + PLUGIN_FORMS_SPACER_MESSAGE + " 4Team Rot hat gewonnen");
consoleSendMessage("5[Test]", "4Rot!");
}
}
} else if (b < 1) {
Expand Down Expand Up @@ -254,8 +253,8 @@ public void PlayerDeath(PlayerMoveEvent evi) {
teams.get(ops).getBlock().getRelative(0, -1, 0).setType(Material.NETHER_BRICK);
teams.clear();
reset();
ops.sendMessage(PLUGIN_PREFIX + PLUGIN_SPACER + " §4Team Rot hat gewonnen");
consoleSendMessage("§5[Test]", "§1Blau!");
ops.sendMessage(PLUGIN_PREFIX + PLUGIN_FORMS_SPACER_MESSAGE + " 4Team Rot hat gewonnen");
consoleSendMessage("5[Test]", "1Blau!");
}
}
}
Expand All @@ -278,9 +277,9 @@ public void PlayerDeath(PlayerMoveEvent evi) {
for (Player pla : Bukkit.getOnlinePlayers()) {
if (pla.getCustomName().equals(TEAM_RED_NAME) || pla.getCustomName().equals(TEAM_BLUE_NAME) || pla.getCustomName().equals(CS_NAME)) {
if (score.getScore() == 0) {
pla.sendMessage(PLUGIN_PREFIX + PLUGIN_SPACER + " §1" + TEAM_BLUE_NAME + " " + player.getDisplayName() + "§1 ist ausgeschieden");
pla.sendMessage(PLUGIN_PREFIX + PLUGIN_FORMS_SPACER_MESSAGE + " 1" + TEAM_BLUE_NAME + " " + player.getDisplayName() + "1 ist ausgeschieden");
} else {
pla.sendMessage(PLUGIN_PREFIX + PLUGIN_SPACER + " §1" + player.getCustomName() + " " + player.getDisplayName() + "§1 starb");
pla.sendMessage(PLUGIN_PREFIX + PLUGIN_FORMS_SPACER_MESSAGE + " 1" + player.getCustomName() + " " + player.getDisplayName() + "1 starb");
}

}
Expand Down

0 comments on commit 0f5cc56

Please sign in to comment.