Commits vergleichen
5 Commits
2bf3cfbb1d
...
85512be3a8
Autor | SHA1 | Datum | |
---|---|---|---|
|
85512be3a8 | ||
|
67c9f66d13 | ||
|
f2a957c88f | ||
|
d1ff80b9dc | ||
|
41ed83dfe0 |
@ -31,6 +31,8 @@ import de.steamwar.linkage.Linked;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.data.type.Chest;
|
import org.bukkit.block.data.type.Chest;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -39,11 +41,9 @@ import org.bukkit.event.inventory.InventoryCloseEvent;
|
|||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
public class AutostartListener implements Listener {
|
public class AutostartListener implements Listener {
|
||||||
@ -117,15 +117,24 @@ public class AutostartListener implements Listener {
|
|||||||
if (regionStartTime.isEmpty()) {
|
if (regionStartTime.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.blockList().forEach(block -> {
|
event.blockList().forEach(block -> {
|
||||||
Region region = Region.getRegion(block.getLocation());
|
Region region = Region.getRegion(block.getLocation());
|
||||||
if (!regionStartTime.containsKey(region)) return;
|
if (!regionStartTime.containsKey(region)) return;
|
||||||
if (!region.hasType(RegionType.TESTBLOCK)) return;
|
if (!region.hasType(RegionType.TESTBLOCK)) return;
|
||||||
if (!region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION)) return;
|
if (!region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION)) return;
|
||||||
long tickDiff = TPSUtils.currentRealTick.get() - regionStartTime.remove(region);
|
long tickDiff = TPSUtils.currentRealTick.get() - regionStartTime.remove(region);
|
||||||
|
long preFightDurationInSeconds = getPreFightDurationInSeconds(region);
|
||||||
RegionUtils.message(region, "AUTOSTART_MESSAGE_RESULT1", tickDiff);
|
RegionUtils.message(region, "AUTOSTART_MESSAGE_RESULT1", tickDiff);
|
||||||
RegionUtils.message(region, "AUTOSTART_MESSAGE_RESULT2", 30, (600 - tickDiff));
|
RegionUtils.message(region, "AUTOSTART_MESSAGE_RESULT2", preFightDurationInSeconds, ((preFightDurationInSeconds * 20) - tickDiff));
|
||||||
RegionUtils.message(region, "AUTOSTART_MESSAGE_RESULT3");
|
RegionUtils.message(region, "AUTOSTART_MESSAGE_RESULT3");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getPreFightDurationInSeconds(Region region) {
|
||||||
|
File file = region.gameModeConfig();
|
||||||
|
if (file == null) return 30;
|
||||||
|
FileConfiguration config = YamlConfiguration.loadConfiguration(file);
|
||||||
|
return config.getInt("Times.PreFightDuration", 30);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,5 +122,14 @@ public class Trace {
|
|||||||
return new LinkedList<>(entitiesRecords.values());
|
return new LinkedList<>(entitiesRecords.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Hides this trail for the given player
|
||||||
|
*
|
||||||
|
* @param player
|
||||||
|
*/
|
||||||
|
public void hide(Player player){
|
||||||
|
REntityServer server = serverMap.get(player);
|
||||||
|
if(server == null) return;
|
||||||
|
|
||||||
|
server.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2023 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.bausystem.features.world;
|
||||||
|
|
||||||
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
|
import de.steamwar.bausystem.BauSystem;
|
||||||
|
import de.steamwar.linkage.Linked;
|
||||||
|
import de.steamwar.linkage.api.Enable;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
|
|
||||||
|
@Linked
|
||||||
|
public class AntiCursorReCentering implements Enable {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enable() {
|
||||||
|
Class<?> closeWindow = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutCloseWindow");
|
||||||
|
TinyProtocol.instance.addFilter(closeWindow, (player, object) -> {
|
||||||
|
if (player.getOpenInventory().getTopInventory().getType() == InventoryType.CRAFTING) {
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||||
|
if (player.getOpenInventory().getTopInventory().getType() == InventoryType.CRAFTING) {
|
||||||
|
TinyProtocol.instance.sendPacket(player, object);
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
In neuem Issue referenzieren
Einen Benutzer sperren