forked from SteamWar/SteamWar
Add version dependant impl
This commit is contained in:
@@ -13,6 +13,7 @@ steamwar.properties
|
|||||||
# VSCode
|
# VSCode
|
||||||
bin/
|
bin/
|
||||||
.vscode
|
.vscode
|
||||||
|
.settings
|
||||||
|
|
||||||
# Other
|
# Other
|
||||||
lib
|
lib
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package de.steamwar.fightsystem.utils;
|
||||||
|
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
|
||||||
|
public class TpsWarper21 implements TpsWarper {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warp(float tps) {
|
||||||
|
MinecraftServer.getServer().tickRateManager().setTickRate(tps);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package de.steamwar.fightsystem.utils;
|
||||||
|
|
||||||
|
import de.steamwar.core.TPSWarpUtils;
|
||||||
|
|
||||||
|
public class TpsWarper8 implements TpsWarper {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warp(float tps) {
|
||||||
|
TPSWarpUtils.warp(tps);
|
||||||
|
}
|
||||||
|
}
|
||||||
+16
-15
@@ -1,20 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* This file is a part of the SteamWar software.
|
* This file is a part of the SteamWar software.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
* Copyright (C) 2025 SteamWar.de-Serverteam
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify it under the terms of the
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* GNU Affero General Public License as published by the Free Software Foundation, either version 3
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* of the License, or (at your option) any later version.
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* Affero General Public License for more details.
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License along with this program.
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package de.steamwar.fightsystem.commands;
|
package de.steamwar.fightsystem.commands;
|
||||||
@@ -24,6 +22,7 @@ import de.steamwar.fightsystem.ArenaMode;
|
|||||||
import de.steamwar.fightsystem.FightSystem;
|
import de.steamwar.fightsystem.FightSystem;
|
||||||
import de.steamwar.fightsystem.states.FightState;
|
import de.steamwar.fightsystem.states.FightState;
|
||||||
import de.steamwar.fightsystem.states.StateDependentCommand;
|
import de.steamwar.fightsystem.states.StateDependentCommand;
|
||||||
|
import de.steamwar.fightsystem.utils.TpsWarper;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@@ -39,15 +38,17 @@ public class TPSWarpCommand implements CommandExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
double tps;
|
float tps;
|
||||||
try {
|
try {
|
||||||
tps = Double.parseDouble(args[0]);
|
tps = Float.parseFloat(args[0]);
|
||||||
} catch (NumberFormatException | ArrayIndexOutOfBoundsException e) {
|
} catch (NumberFormatException | ArrayIndexOutOfBoundsException e) {
|
||||||
FightSystem.getMessage().send("TPSWARP_HELP", sender);
|
FightSystem.getMessage().send("TPSWARP_HELP", sender);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TPSWarpUtils.warp(tps);
|
TpsWarper warper = TpsWarper.impl;
|
||||||
|
warper.warp(tps);
|
||||||
|
|
||||||
FightSystem.getMessage().broadcastActionbar("TPSWARP_SET", tps);
|
FightSystem.getMessage().broadcastActionbar("TPSWARP_SET", tps);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package de.steamwar.fightsystem.utils;
|
||||||
|
|
||||||
|
import de.steamwar.core.VersionDependent;
|
||||||
|
import de.steamwar.fightsystem.FightSystem;
|
||||||
|
|
||||||
|
public interface TpsWarper {
|
||||||
|
TpsWarper impl = VersionDependent.getVersionImpl(FightSystem.getPlugin());
|
||||||
|
|
||||||
|
void warp(float tps);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user