/freeze
Dieser Commit ist enthalten in:
Ursprung
fcc76ae559
Commit
981938ea6c
@ -77,6 +77,7 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
getCommand("bauinfo").setExecutor(new CommandInfo());
|
||||
getCommand("protect").setExecutor(new CommandProtect());
|
||||
getCommand("skull").setExecutor(new CommandSkull());
|
||||
getCommand("freeze").setExecutor(new CommandFreeze());
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(this, this);
|
||||
Bukkit.getPluginManager().registerEvents(new RegionListener(), this);
|
||||
|
46
src/de/steamwar/bausystem/commands/CommandFreeze.java
Normale Datei
46
src/de/steamwar/bausystem/commands/CommandFreeze.java
Normale Datei
@ -0,0 +1,46 @@
|
||||
package de.steamwar.bausystem.commands;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.world.Welt;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
|
||||
public class CommandFreeze implements CommandExecutor, Listener {
|
||||
|
||||
private boolean frozen = false;
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player))
|
||||
return false;
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (!Welt.hasPermission(player, Permission.world)){
|
||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst diese Welt nicht einfrieren");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(frozen){
|
||||
HandlerList.unregisterAll(this);
|
||||
Bukkit.broadcastMessage(BauSystem.PREFIX + "§cDie Welt wurde eingefroren");
|
||||
}else{
|
||||
Bukkit.getPluginManager().registerEvents(this, BauSystem.getPlugin());
|
||||
Bukkit.broadcastMessage(BauSystem.PREFIX + "§aDie Welt wurde aufgetaut");
|
||||
}
|
||||
frozen = !frozen;
|
||||
return false;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPhysicsEvent(BlockPhysicsEvent e){
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
@ -15,5 +15,6 @@ commands:
|
||||
bauinfo:
|
||||
speed:
|
||||
skull:
|
||||
freeze:
|
||||
nightvision:
|
||||
aliases: nv
|
In neuem Issue referenzieren
Einen Benutzer sperren