SteamWar/BauSystem2.0
Archiviert
12
0

Commits vergleichen

..

Keine gemeinsamen Commits. "85512be3a82d7f1f14d822a8147aa426abb8aef5" und "2bf3cfbb1d0cafaa84a6ee771d5f849ba8bdaaaa" haben vollständig unterschiedliche Historien.

3 geänderte Dateien mit 5 neuen und 71 gelöschten Zeilen

Datei anzeigen

@ -31,8 +31,6 @@ import de.steamwar.linkage.Linked;
import lombok.Getter;
import org.bukkit.Material;
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.event.EventHandler;
import org.bukkit.event.Listener;
@ -41,9 +39,11 @@ import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Linked
public class AutostartListener implements Listener {
@ -117,24 +117,15 @@ public class AutostartListener implements Listener {
if (regionStartTime.isEmpty()) {
return;
}
event.blockList().forEach(block -> {
Region region = Region.getRegion(block.getLocation());
if (!regionStartTime.containsKey(region)) return;
if (!region.hasType(RegionType.TESTBLOCK)) return;
if (!region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION)) return;
long tickDiff = TPSUtils.currentRealTick.get() - regionStartTime.remove(region);
long preFightDurationInSeconds = getPreFightDurationInSeconds(region);
RegionUtils.message(region, "AUTOSTART_MESSAGE_RESULT1", tickDiff);
RegionUtils.message(region, "AUTOSTART_MESSAGE_RESULT2", preFightDurationInSeconds, ((preFightDurationInSeconds * 20) - tickDiff));
RegionUtils.message(region, "AUTOSTART_MESSAGE_RESULT2", 30, (600 - tickDiff));
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);
}
}

Datei anzeigen

@ -122,14 +122,5 @@ public class Trace {
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();
}
}

Datei anzeigen

@ -1,48 +0,0 @@
/*
* 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;
});
}
}