SteamWar/BauSystem
Archiviert
13
0

Tracer-entity #147

Manuell gemergt
YoyoNow hat 47 Commits von Tracer-entity nach master 2020-12-27 22:16:04 +01:00 zusammengeführt
2 geänderte Dateien mit 84 neuen und 4 gelöschten Zeilen
Nur Änderungen aus Commit 0864b1bc92 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -2,10 +2,7 @@ package de.steamwar.bausystem.tracer.show;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.tracer.TNTPosition; import de.steamwar.bausystem.tracer.TNTPosition;
import de.steamwar.bausystem.tracer.show.mode.Advanced; import de.steamwar.bausystem.tracer.show.mode.*;
import de.steamwar.bausystem.tracer.show.mode.AdvancedNoWater;
import de.steamwar.bausystem.tracer.show.mode.Basic;
import de.steamwar.bausystem.tracer.show.mode.BasicNoWater;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -40,6 +37,9 @@ public class TraceShowManager implements Listener {
case "advancednowater": case "advancednowater":
showMode = new AdvancedNoWater(player); showMode = new AdvancedNoWater(player);
break; break;
case "experimental":
showMode = new Experimental(player);
break;
case "basic": case "basic":
case "default": case "default":
default: default:

Datei anzeigen

@ -0,0 +1,80 @@
/*
*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* /
*/
package de.steamwar.bausystem.tracer.show.mode;
import de.steamwar.bausystem.tracer.*;
import de.steamwar.bausystem.tracer.show.ShowMode;
import de.steamwar.core.Core;
import net.minecraft.server.v1_15_R1.EntityTNTPrimed;
import org.bukkit.entity.Player;
import java.util.HashMap;
import java.util.Map;
public class Experimental implements ShowMode {
private final Player player;
private Map<RoundedTNTPosition, AbstractTraceEntity> tntEntityMap = new HashMap<>();
public Experimental(Player player) {
this.player = player;
}
@Override
public void show(TNTPosition position) {
RoundedTNTPosition roundedTNTPosition = new RoundedTNTPosition(position);
if (tntEntityMap.containsKey(roundedTNTPosition)) {
return;
}
switch (Core.getVersion()) {
case 12:
tntEntityMap.put(roundedTNTPosition, TNTTracer_12.createTNT(player.getWorld(), position, player));
break;
default:
tntEntityMap.put(roundedTNTPosition, TNTTracer_15.createTNT(player.getWorld(), position, player));
break;
}
position = new TNTPosition(position.getLocation().clone().subtract(position.getVelocity().clone().multiply(0.98D / 20)));
switch (Core.getVersion()) {
case 12:
tntEntityMap.put(roundedTNTPosition, TNTTracer_12.createUpdatePoint(player.getWorld(), position, player));
break;
default:
tntEntityMap.put(roundedTNTPosition, TNTTracer_15.createUpdatePoint(player.getWorld(), position, player));
break;
}
}
@Override
public void hide() {
tntEntityMap.forEach((roundedTNTPosition, abstractTraceEntity) -> {
abstractTraceEntity.hide(player);
abstractTraceEntity.remove();
});
tntEntityMap.clear();
}
}