set compasstimer to 15 sec
This commit is contained in:
parent
b5f6ac467b
commit
6b9cc4ffc0
@ -26,10 +26,9 @@ public class ItemUseListener implements Consumer<PlayerUseItemEvent> {
|
|||||||
CompassManager compassManager = CompassManager.getInstance();
|
CompassManager compassManager = CompassManager.getInstance();
|
||||||
if (!p.isAllowCompassUsage()) {
|
if (!p.isAllowCompassUsage()) {
|
||||||
long lastUsed = (System.currentTimeMillis() - p.getLastCompassUsage()) / 1000;
|
long lastUsed = (System.currentTimeMillis() - p.getLastCompassUsage()) / 1000;
|
||||||
p.sendActionBar(Component.text("Du kannst den Kompass erst in " + (10 - lastUsed) + " Sekunden wieder benutzen."));
|
p.sendActionBar(Component.text("Du kannst den Kompass erst in " + (15 - lastUsed) + " Sekunden wieder benutzen."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p.update_lastCompassUsage();
|
|
||||||
p.openInventory(compassManager.getInventory());
|
p.openInventory(compassManager.getInventory());
|
||||||
}
|
}
|
||||||
private void bedUse(NewPlayer player) {
|
private void bedUse(NewPlayer player) {
|
||||||
|
@ -29,7 +29,7 @@ public class NewPlayer extends Player {
|
|||||||
}
|
}
|
||||||
public boolean isAllowCompassUsage() {
|
public boolean isAllowCompassUsage() {
|
||||||
long UsageDifference = System.currentTimeMillis() - lastCompassUsage;
|
long UsageDifference = System.currentTimeMillis() - lastCompassUsage;
|
||||||
long difference = 10000; //in Milisec
|
long difference = 15000; //in Milisec
|
||||||
return UsageDifference >= difference && allowCompassUsage;
|
return UsageDifference >= difference && allowCompassUsage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user