SteamWar/BauSystem
Archiviert
13
0
Dieser Commit ist enthalten in:
Chaoscaot 2020-09-11 21:32:32 +02:00
Ursprung c27a548866
Commit 6f8c3961a2
5 geänderte Dateien mit 30 neuen und 29 gelöschten Zeilen

Datei anzeigen

@ -90,17 +90,17 @@ class AutoLoader_12 {
return new Detoloader("Hebel", 0).setActive(true);
}
}else if(material == Material.STONE_BUTTON){
return new Detoloader("Knopf", 20);
return new Detoloader("Knopf", Detoloader.STONE_BUTTON);
}else if(material == Material.WOOD_BUTTON){
return new Detoloader("Knopf", 30);
return new Detoloader("Knopf", Detoloader.WOODEN_BUTTON);
}else if (material == Material.NOTE_BLOCK) {
return new Detoloader("Noteblock", 1);
return new Detoloader("Noteblock", Detoloader.NOTE_BLOCK);
}else if(material == Material.STONE_PLATE || material == Material.WOOD_PLATE){
return new Detoloader("Druckplatte", 20);
return new Detoloader("Druckplatte", Detoloader.PRESSURE_PLATE);
}else if (material == Material.TRIPWIRE) {
return new Detoloader("Tripwire", 10);
return new Detoloader("Tripwire", Detoloader.TRIPWIRE);
}
return new Detoloader("§eUnbekannter Block betätigt (nicht aufgenommen)", 0).setAddBack(false);
return new Detoloader("§eUnbekannter Block betätigt (nicht aufgenommen)", -1).setAddBack(false);
}
static boolean getLever(Block block) {

Datei anzeigen

@ -100,17 +100,17 @@ class AutoLoader_15 {
return new Detoloader("Hebel", 0).setActive(true);
}
} else if (material == Material.STONE_BUTTON) {
return new Detoloader("Knopf", 20);
return new Detoloader("Knopf", Detoloader.STONE_BUTTON);
} else if (material.name().contains("PRESSURE_PLATE")){
return new Detoloader("Druckplatte", 20);
return new Detoloader("Druckplatte", Detoloader.PRESSURE_PLATE);
} else if (material.name().contains("BUTTON")) {
return new Detoloader("Knopf", 30);
return new Detoloader("Knopf", Detoloader.WOODEN_BUTTON);
}else if (material == Material.NOTE_BLOCK) {
return new Detoloader("Noteblock", 1);
return new Detoloader("Noteblock", Detoloader.NOTE_BLOCK);
}else if (material.name().equals("TRIPWIRE")) {
return new Detoloader("Tripwire", 10);
return new Detoloader("Tripwire", Detoloader.TRIPWIRE);
} else {
return new Detoloader("§eUnbekannter Block betätigt", 0).setAddBack(false);
return new Detoloader("§eUnbekannter Block betätigt (aufgenommen)", 0).setAddBack(false);
}
}

Datei anzeigen

@ -77,4 +77,11 @@ public class Detoloader {
this.location = location;
}
}
//Timings
public static final int STONE_BUTTON = 20;
public static final int WOODEN_BUTTON = 30;
public static final int PRESSURE_PLATE = 20;
public static final int NOTE_BLOCK = 20;
public static final int TRIPWIRE = 10;
}

Datei anzeigen

@ -36,9 +36,11 @@ import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
@ -160,8 +162,6 @@ public class BauSystem extends JavaPlugin implements Listener {
if (Core.getVersion() == 15)
Bukkit.getWorlds().get(0).setGameRule(GameRule.REDUCED_DEBUG_INFO, false);
if (p.getInventory().contains(Detonator.WAND))
Detonator.getDetonator(p);
}
@EventHandler

Datei anzeigen

@ -24,7 +24,6 @@ import de.steamwar.core.Core;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -52,7 +51,6 @@ public class Detonator implements Listener {
ItemMeta im = WAND.getItemMeta();
im.setDisplayName("§6Fernzünder");
im.addItemFlags(ItemFlag.HIDE_ENCHANTS);
List<String> lorelist = Arrays.asList("§eLinks Klick §8- §7Setzte einen Punkt zum Aktivieren",
"§eLinks Klick + Shift §8- §7Füge einen Punkt hinzu", "§eRechts Klick §8- §7Löse alle Punkte aus");
@ -74,6 +72,7 @@ public class Detonator implements Listener {
}
public static void deleteDetonator(Player player) {
if(players.containsKey(player))
players.remove(player);
}
@ -129,12 +128,16 @@ public class Detonator implements Listener {
locs.forEach(detonatorActivation -> {
if(detonatorActivation.location.equals(event.getClickedBlock().getLocation())) locs.remove(detonatorActivation);
});
print(detoloader.addBack ? "§e" + detoloader.getBlock() + " entfernt" :
detoloader.getBlock(), detoloader.addBack);
}else {
if(detoloader.getActivation() == 0) {
locs.add(new Detoloader.DetonatorActivation(event.getClickedBlock().getLocation()));
}else {
locs.add(new Detoloader.DetonatorActivation(detoloader.getActivation(), event.getClickedBlock().getLocation()));
}
print(detoloader.addBack ? "§e" + detoloader.getBlock() + " hinzugefügt" :
detoloader.getBlock(), detoloader.addBack);
}
}else {
locs.clear();
@ -143,9 +146,9 @@ public class Detonator implements Listener {
}else {
locs.add(new Detoloader.DetonatorActivation(detoloader.getActivation(), event.getClickedBlock().getLocation()));
}
}
print(detoloader.addBack ? "§e" + detoloader.getBlock() + " hinzugefügt" :
print(detoloader.addBack ? "§e" + detoloader.getBlock() + " getsetzt" :
detoloader.getBlock(), detoloader.addBack);
}
break;
case RIGHT_CLICK_AIR:
case RIGHT_CLICK_BLOCK:
@ -157,22 +160,13 @@ public class Detonator implements Listener {
@EventHandler(ignoreCancelled = true)
public void onPlayerQuit(PlayerQuitEvent event) {
players.remove(event.getPlayer());
deleteDetonator(event.getPlayer());
}
Set<Detoloader.DetonatorActivation> getLocations() {
return locs;
}
boolean setRedstone(Location location, boolean active) {
switch(Core.getVersion()){
case 15:
return AutoLoader_15.setRedstone(location, active);
default:
return AutoLoader_12.setRedstone(location, active);
}
}
Player getPlayer() {
return player;
}