ChorusLimiter
This commit is contained in:
parent
4a2f9dd496
commit
e103195300
@ -9,6 +9,7 @@ import cz.marwland.mc.core.features.Base;
|
|||||||
import cz.marwland.mc.core.features.Feature;
|
import cz.marwland.mc.core.features.Feature;
|
||||||
import cz.marwland.mc.essentials.features.Borders;
|
import cz.marwland.mc.essentials.features.Borders;
|
||||||
import cz.marwland.mc.essentials.features.ChatNotifier;
|
import cz.marwland.mc.essentials.features.ChatNotifier;
|
||||||
|
import cz.marwland.mc.essentials.features.ChorusLimiter;
|
||||||
import cz.marwland.mc.essentials.features.RandomTeleport;
|
import cz.marwland.mc.essentials.features.RandomTeleport;
|
||||||
|
|
||||||
public class MarwCore extends JavaPlugin {
|
public class MarwCore extends JavaPlugin {
|
||||||
@ -27,6 +28,7 @@ public class MarwCore extends JavaPlugin {
|
|||||||
this.addFeature(new Base());
|
this.addFeature(new Base());
|
||||||
this.addFeature(new Borders());
|
this.addFeature(new Borders());
|
||||||
this.addFeature(new ChatNotifier());
|
this.addFeature(new ChatNotifier());
|
||||||
|
this.addFeature(new ChorusLimiter());
|
||||||
this.addFeature(new RandomTeleport());
|
this.addFeature(new RandomTeleport());
|
||||||
|
|
||||||
configManager.load();
|
configManager.load();
|
||||||
|
30
src/cz/marwland/mc/essentials/features/ChorusLimiter.java
Normal file
30
src/cz/marwland/mc/essentials/features/ChorusLimiter.java
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package cz.marwland.mc.essentials.features;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||||
|
|
||||||
|
import com.connorlinfoot.bountifulapi.BountifulAPI;
|
||||||
|
|
||||||
|
import cz.marwland.mc.core.features.Feature;
|
||||||
|
import cz.marwland.mc.core.util.Cooldown;
|
||||||
|
import net.md_5.bungee.api.ChatColor;
|
||||||
|
|
||||||
|
public class ChorusLimiter extends Feature {
|
||||||
|
|
||||||
|
private Cooldown chorusCooldown = new Cooldown(this);
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerItemConsume(PlayerItemConsumeEvent e) {
|
||||||
|
if (e.getItem().getType() != Material.CHORUS_FRUIT)
|
||||||
|
return;
|
||||||
|
|
||||||
|
long left = chorusCooldown.timeLeftSeconds(e.getPlayer());
|
||||||
|
if (left > 0) {
|
||||||
|
BountifulAPI.sendActionBar(e.getPlayer(), ChatColor.RED + "Musis pockat jeste " + left + " sekund pro pouziti Chrois Fruitu!");
|
||||||
|
e.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user