NV & Tracer (non working)
Dieser Commit ist enthalten in:
Ursprung
d47f375a85
Commit
7b9c1da8ae
@ -5,10 +5,7 @@ import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
|||||||
import de.pro_crafting.commandframework.CommandArgs;
|
import de.pro_crafting.commandframework.CommandArgs;
|
||||||
import de.pro_crafting.commandframework.CommandFramework;
|
import de.pro_crafting.commandframework.CommandFramework;
|
||||||
import de.pro_crafting.commandframework.Completer;
|
import de.pro_crafting.commandframework.Completer;
|
||||||
import de.warking.bausystem.commands.CommandBau;
|
import de.warking.bausystem.commands.*;
|
||||||
import de.warking.bausystem.commands.CommandGamemode;
|
|
||||||
import de.warking.bausystem.commands.CommandGui;
|
|
||||||
import de.warking.bausystem.commands.CommandTeleport;
|
|
||||||
import de.warking.bausystem.config.Config;
|
import de.warking.bausystem.config.Config;
|
||||||
import de.warking.bausystem.world.LagDetectorRunnable;
|
import de.warking.bausystem.world.LagDetectorRunnable;
|
||||||
import de.warking.bausystem.world.RegionListener;
|
import de.warking.bausystem.world.RegionListener;
|
||||||
@ -82,7 +79,6 @@ public class BauSystem extends JavaPlugin implements Listener {
|
|||||||
getRegionData.set("regions.airship1.schematic.testblock", " ");
|
getRegionData.set("regions.airship1.schematic.testblock", " ");
|
||||||
getRegionData.set("regions.airship1.schematic.reset", " ");
|
getRegionData.set("regions.airship1.schematic.reset", " ");
|
||||||
|
|
||||||
|
|
||||||
saveRegionData();
|
saveRegionData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,6 +108,8 @@ public class BauSystem extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmdFramework.registerCommands(new CommandBau());
|
cmdFramework.registerCommands(new CommandBau());
|
||||||
|
cmdFramework.registerCommands(new CommandNV());
|
||||||
|
cmdFramework.registerCommands(new CommandTrace());
|
||||||
Bukkit.getPluginManager().registerEvents(new RegionListener(this), this);
|
Bukkit.getPluginManager().registerEvents(new RegionListener(this), this);
|
||||||
|
|
||||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> {
|
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> {
|
||||||
@ -261,6 +259,8 @@ public class BauSystem extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
attachment.setPermission("F3NPerm.use", true);
|
attachment.setPermission("F3NPerm.use", true);
|
||||||
attachment.setPermission("fawe.permpack.basic", true);
|
attachment.setPermission("fawe.permpack.basic", true);
|
||||||
|
attachment.setPermission("worldedit.navigation.jumpto.tool", true);
|
||||||
|
attachment.setPermission("worldedit.navigation.thru.tool", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -30,7 +30,7 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public class CommandBau {
|
public class CommandBau {
|
||||||
|
|
||||||
@Command(name = "bau", aliases = "gs")
|
@Command(name = "bau", aliases = "gs", inGameOnly = true)
|
||||||
public void onBau(CommandArgs args) {
|
public void onBau(CommandArgs args) {
|
||||||
onHelp(args);
|
onHelp(args);
|
||||||
}
|
}
|
||||||
@ -67,6 +67,7 @@ public class CommandBau {
|
|||||||
p.sendMessage("§6/bau togglereset §7- Darf ein Spieler eine Region erneuern");
|
p.sendMessage("§6/bau togglereset §7- Darf ein Spieler eine Region erneuern");
|
||||||
p.sendMessage("§6/bau togglereplace §7- Darf ein Spieler in einer Region replacen");
|
p.sendMessage("§6/bau togglereplace §7- Darf ein Spieler in einer Region replacen");
|
||||||
p.sendMessage("§6/bau togglechgm §7- Darf ein Spieler seinen Spielmodus ändern");
|
p.sendMessage("§6/bau togglechgm §7- Darf ein Spieler seinen Spielmodus ändern");
|
||||||
|
p.sendMessage("§6/nv §7- Aktiviert/Deaktiviert Nachtsicht");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(name = "bau.home", aliases = "gs.home", inGameOnly = true)
|
@Command(name = "bau.home", aliases = "gs.home", inGameOnly = true)
|
||||||
@ -141,7 +142,7 @@ public class CommandBau {
|
|||||||
if (id == null) {
|
if (id == null) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cUnbekannter Spieler");
|
p.sendMessage(BauSystem.PREFIX + "§cUnbekannter Spieler");
|
||||||
return;
|
return;
|
||||||
}else if (Bauwelt.getBauwelt(id) == null && !p.hasPermission("bau.team")) {
|
}else if (BauweltMember.getBauMember(id, p.getUniqueId()) == null && !p.hasPermission("bau.team")) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cDu bist kein Mitglied dieser Welt");
|
p.sendMessage(BauSystem.PREFIX + "§cDu bist kein Mitglied dieser Welt");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
25
src/de/warking/bausystem/commands/CommandNV.java
Normale Datei
25
src/de/warking/bausystem/commands/CommandNV.java
Normale Datei
@ -0,0 +1,25 @@
|
|||||||
|
package de.warking.bausystem.commands;
|
||||||
|
|
||||||
|
import de.pro_crafting.commandframework.Command;
|
||||||
|
import de.pro_crafting.commandframework.CommandArgs;
|
||||||
|
import de.warking.bausystem.BauSystem;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
public class CommandNV {
|
||||||
|
|
||||||
|
@Command(name = "nv", aliases = "nightvision", inGameOnly = true)
|
||||||
|
public void onNightVision(CommandArgs args){
|
||||||
|
Player p = args.getPlayer();
|
||||||
|
for(PotionEffect effect : p.getActivePotionEffects()){
|
||||||
|
if(effect.getType().equals(PotionEffectType.NIGHT_VISION)){
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "Nachtsicht deaktiviert");
|
||||||
|
p.removePotionEffect(PotionEffectType.NIGHT_VISION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 1000000, 255, false, false));
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "Nachtsicht aktiviert");
|
||||||
|
}
|
||||||
|
}
|
@ -72,7 +72,7 @@ public class CommandTeleport extends BukkitCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(worldOwner != p.getUniqueId()){
|
if(!worldOwner.equals(p.getUniqueId())){
|
||||||
BauweltMember member = BauweltMember.getBauMember(worldOwner, p.getUniqueId());
|
BauweltMember member = BauweltMember.getBauMember(worldOwner, p.getUniqueId());
|
||||||
if(member == null || !member.isTeleport()){
|
if(member == null || !member.isTeleport()){
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst dich auf dieser Welt nicht teleportieren!");
|
p.sendMessage(BauSystem.PREFIX + "§cDu darfst dich auf dieser Welt nicht teleportieren!");
|
||||||
@ -80,11 +80,6 @@ public class CommandTeleport extends BukkitCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (!BauweltMember.getBauMember(p.getUniqueId(), target.getUniqueId()).isTeleport()){
|
|
||||||
sender.sendMessage("Die Spieler sind nicht auf der selben Bauwelt.");
|
|
||||||
return false;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
p.teleport(target, PlayerTeleportEvent.TeleportCause.COMMAND);
|
p.teleport(target, PlayerTeleportEvent.TeleportCause.COMMAND);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
95
src/de/warking/bausystem/commands/CommandTrace.java
Normale Datei
95
src/de/warking/bausystem/commands/CommandTrace.java
Normale Datei
@ -0,0 +1,95 @@
|
|||||||
|
package de.warking.bausystem.commands;
|
||||||
|
|
||||||
|
import de.pro_crafting.commandframework.Command;
|
||||||
|
import de.pro_crafting.commandframework.CommandArgs;
|
||||||
|
import de.warking.bausystem.BauSystem;
|
||||||
|
import de.warking.bausystem.world.TNTTracer;
|
||||||
|
import de.warking.hunjy.MySQL.BauweltMember;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class CommandTrace {
|
||||||
|
|
||||||
|
@Command(name = "trace", inGameOnly = true)
|
||||||
|
public void onTrace(CommandArgs args){
|
||||||
|
Player p = args.getPlayer();
|
||||||
|
p.sendMessage("§6/trace start §7- Startet die Aufnahme aller TNT-Positionen");
|
||||||
|
p.sendMessage("§6/trace show §7- Zeigt alle TNT-Positionen");
|
||||||
|
p.sendMessage("§6/trace hide §7- Versteckt die TNT-Positionen wieder");
|
||||||
|
p.sendMessage("§6/trace stop §7- Bricht die Aufnahme ab");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Command(name = "trace.start", inGameOnly = true)
|
||||||
|
public void onStart(CommandArgs args){
|
||||||
|
Player p = args.getPlayer();
|
||||||
|
if(checkPerm(p)){
|
||||||
|
TNTTracer.newTracer(p.getWorld());
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "§aAufnahme gestartet");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Command(name = "trace.stop", inGameOnly = true)
|
||||||
|
public void onStop(CommandArgs args){
|
||||||
|
Player p = args.getPlayer();
|
||||||
|
if(checkPerm(p)){
|
||||||
|
TNTTracer t = TNTTracer.get(p.getWorld());
|
||||||
|
if(t == null){
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "§cKein laufender TNT-Tracer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
t.end();
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "§aAufnahme abgebrochen");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Command(name = "trace.show", inGameOnly = true)
|
||||||
|
public void onShow(CommandArgs args){
|
||||||
|
Player p = args.getPlayer();
|
||||||
|
if(checkPerm(p)){
|
||||||
|
TNTTracer t = TNTTracer.get(p.getWorld());
|
||||||
|
if(t == null){
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "§cKein laufender TNT-Tracer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
t.show();
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "§aTNT-Positionen angezeigt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Command(name = "trace.hide", inGameOnly = true)
|
||||||
|
public void onHide(CommandArgs args){
|
||||||
|
Player p = args.getPlayer();
|
||||||
|
if(checkPerm(p)){
|
||||||
|
TNTTracer t = TNTTracer.get(p.getWorld());
|
||||||
|
if(t == null){
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "§cKein laufender TNT-Tracer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
t.hide();
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "§aTNT-Positionen versteckt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean checkPerm(Player p){
|
||||||
|
UUID id;
|
||||||
|
try{
|
||||||
|
id = UUID.fromString(p.getWorld().getName());
|
||||||
|
}catch(IllegalArgumentException E){
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "§cDu bist auf keiner Bauwelt");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(p.getUniqueId().equals(id)){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
BauweltMember member = BauweltMember.getBauMember(id, p.getUniqueId());
|
||||||
|
if(member == null || member.isTestblock()) {
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den TNT-Tracer nutzen");
|
||||||
|
return false;
|
||||||
|
}else{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -20,6 +20,7 @@ public class LagDetectorRunnable implements Runnable {
|
|||||||
world.setThundering(false);
|
world.setThundering(false);
|
||||||
world.setMonsterSpawnLimit(0);
|
world.setMonsterSpawnLimit(0);
|
||||||
world.setAnimalSpawnLimit(0);
|
world.setAnimalSpawnLimit(0);
|
||||||
|
world.setGameRuleValue("announceAdvancements", "false");
|
||||||
|
|
||||||
UUID worldOwner;
|
UUID worldOwner;
|
||||||
|
|
||||||
|
136
src/de/warking/bausystem/world/TNTTracer.java
Normale Datei
136
src/de/warking/bausystem/world/TNTTracer.java
Normale Datei
@ -0,0 +1,136 @@
|
|||||||
|
package de.warking.bausystem.world;
|
||||||
|
|
||||||
|
import de.warking.bausystem.BauSystem;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.TNTPrimed;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
|
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||||
|
import org.bukkit.event.world.WorldUnloadEvent;
|
||||||
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class TNTTracer implements Listener, Runnable {
|
||||||
|
|
||||||
|
private static final Map<World, TNTTracer> allTracer = new HashMap<>();
|
||||||
|
|
||||||
|
private final World world;
|
||||||
|
private final BukkitTask task;
|
||||||
|
private final Set<Location> locations;
|
||||||
|
private final Set<TNTPrimed> tnts;
|
||||||
|
private boolean printed;
|
||||||
|
|
||||||
|
private TNTTracer(World world){
|
||||||
|
this.world = world;
|
||||||
|
this.locations = new HashSet<>();
|
||||||
|
this.tnts = new HashSet<>();
|
||||||
|
this.printed = false;
|
||||||
|
this.task = Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), this, 1, 1);
|
||||||
|
Bukkit.getPluginManager().registerEvents(this, BauSystem.getInstance());
|
||||||
|
allTracer.put(world, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stop(){
|
||||||
|
task.cancel();
|
||||||
|
tnts.clear();
|
||||||
|
HandlerList.unregisterAll(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void end(){
|
||||||
|
stop();
|
||||||
|
locations.clear();
|
||||||
|
allTracer.remove(world);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void show(){
|
||||||
|
stop();
|
||||||
|
printed = true;
|
||||||
|
Set<Location> unsetLoc = new HashSet<>();
|
||||||
|
for(Location l : locations){
|
||||||
|
Block b = world.getBlockAt(l);
|
||||||
|
if(b.getType() != Material.AIR){
|
||||||
|
unsetLoc.add(l);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
b.setType(Material.STAINED_GLASS);
|
||||||
|
b.setData((byte) 1);
|
||||||
|
}
|
||||||
|
locations.removeAll(unsetLoc);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void hide(){
|
||||||
|
end();
|
||||||
|
if(!printed)
|
||||||
|
return;
|
||||||
|
for(Location l : locations){
|
||||||
|
Block b = world.getBlockAt(l);
|
||||||
|
if(b.getType() != Material.STAINED_GLASS || b.getData() != 1)
|
||||||
|
continue;
|
||||||
|
b.setType(Material.AIR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onExplode(EntityExplodeEvent e){
|
||||||
|
if(e.getEntityType() != EntityType.PRIMED_TNT)
|
||||||
|
return;
|
||||||
|
|
||||||
|
tnts.remove((TNTPrimed) e.getEntity());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onSpawn(EntitySpawnEvent e){
|
||||||
|
if(e.getEntityType() != EntityType.PRIMED_TNT)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(e.getLocation().getWorld() != world)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(tnts.size() > 150){
|
||||||
|
for(Player p : Bukkit.getOnlinePlayers()){
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "§cEs können nicht mehr als 150 TNT verfolgt werden!");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
tnts.add((TNTPrimed) e.getEntity());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onUnloadWorld(WorldUnloadEvent e){
|
||||||
|
if(e.getWorld().equals(world)){
|
||||||
|
end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
for(TNTPrimed tnt : tnts){
|
||||||
|
locations.add(tnt.getLocation());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void newTracer(World w){
|
||||||
|
if(allTracer.containsKey(w)){
|
||||||
|
TNTTracer existing = allTracer.get(w);
|
||||||
|
existing.end();
|
||||||
|
}
|
||||||
|
new TNTTracer(w);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TNTTracer get(World w){
|
||||||
|
return allTracer.get(w);
|
||||||
|
}
|
||||||
|
}
|
In neuem Issue referenzieren
Einen Benutzer sperren