Merge branch 'autoLoader15' of SteamWar/BauSystem into master
Dieser Commit ist enthalten in:
Commit
14822378ce
@ -2,25 +2,69 @@ package de.steamwar.bausystem.world;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Powerable;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
class AutoLoader_15 {
|
||||
private AutoLoader_15(){}
|
||||
private AutoLoader_15() {
|
||||
}
|
||||
|
||||
static boolean tntPlaceActionPerform(Location location){
|
||||
static boolean tntPlaceActionPerform(Location location) {
|
||||
Material m = location.getBlock().getType();
|
||||
if(m != Material.AIR && m != Material.WATER)
|
||||
if (m != Material.AIR && m != Material.WATER)
|
||||
return false;
|
||||
|
||||
location.getBlock().setType(Material.TNT);
|
||||
return true;
|
||||
}
|
||||
|
||||
static boolean setRedstone(Location location, boolean active){
|
||||
static boolean setRedstone(Location location, boolean active) {
|
||||
Block block = location.getBlock();
|
||||
BlockData data = block.getBlockData();
|
||||
if (!(data instanceof Powerable))
|
||||
return false;
|
||||
|
||||
Powerable powerable = (Powerable) data;
|
||||
powerable.setPowered(active);
|
||||
block.setBlockData(powerable);
|
||||
block.getState().update(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
static void onPlayerInteract(IAutoLoader loader, PlayerInteractEvent event){
|
||||
loader.print("§cDer AutoLoader ist in der 1.14 noch nicht fertig implementiert", false);
|
||||
static void onPlayerInteract(IAutoLoader loader, PlayerInteractEvent event) {
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.PHYSICAL)
|
||||
return;
|
||||
|
||||
Block block = event.getClickedBlock();
|
||||
assert block != null;
|
||||
BlockData data = block.getBlockData();
|
||||
if (!(data instanceof Powerable))
|
||||
return;
|
||||
Powerable powerable = (Powerable) data;
|
||||
Material material = block.getType();
|
||||
|
||||
if (material == Material.LEVER) {
|
||||
if (powerable.isPowered()) {
|
||||
new IAutoLoader.RedstoneActivation(loader, block.getLocation(), loader.getLastActivation(), false);
|
||||
loader.print("§eHebel zurückgesetzt", true);
|
||||
} else {
|
||||
new IAutoLoader.RedstoneActivation(loader, block.getLocation(), 1, true);
|
||||
loader.print("§eHebel betätigt", true);
|
||||
}
|
||||
} else if (material == Material.STONE_BUTTON) {
|
||||
new IAutoLoader.TemporaryActivation(loader, block.getLocation(), 20);
|
||||
loader.print("§eKnopf betätigt", true);
|
||||
} else if (material.name().contains("PRESSURE_PLATE")){
|
||||
new IAutoLoader.TemporaryActivation(loader, block.getLocation(), 20);
|
||||
loader.print("§eDruckplatte betätigt", true);
|
||||
} else if (material.name().contains("BUTTON")) {
|
||||
new IAutoLoader.TemporaryActivation(loader, block.getLocation(), 30);
|
||||
loader.print("§eKnopf betätigt", true);
|
||||
} else {
|
||||
loader.print("§eUnbekannter Block betätigt (nicht aufgenommen)", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,48 +0,0 @@
|
||||
package de.steamwar.bausystem.commands;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.world.Welt;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CommandSlow implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player))
|
||||
return false;
|
||||
Player player = (Player) sender;
|
||||
|
||||
if(args.length == 0){
|
||||
player.sendMessage(BauSystem.PREFIX + "§8/§7slow §8[§eTPS§8]");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(Welt.noPermission(player, Permission.world)){
|
||||
player.sendMessage(BauSystem.PREFIX + "§cDu darst hier die Geschwindigkeit nicht verstellen");
|
||||
return false;
|
||||
}
|
||||
|
||||
float tps;
|
||||
try{
|
||||
tps = Float.parseFloat(args[0]);
|
||||
}catch(NumberFormatException e){
|
||||
player.sendMessage(BauSystem.PREFIX + "§cDu solltest eine Zahl angeben...");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(tps > 20){
|
||||
player.sendMessage(BauSystem.PREFIX + "§cTut mir leid, aber das ist nicht möglich (TPS > 20)");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(tps == 20){
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
In neuem Issue referenzieren
Einen Benutzer sperren