2021-03-22 23:06:40 +01:00
|
|
|
/*
|
|
|
|
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
2023-01-12 12:45:53 +01:00
|
|
|
* Copyright (C) 2016-2023 ViaVersion and contributors
|
2021-03-22 23:06:40 +01:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2021-04-26 20:52:34 +02:00
|
|
|
package com.viaversion.viaversion.bukkit.platform;
|
2016-09-30 01:34:16 +02:00
|
|
|
|
2021-04-26 20:52:34 +02:00
|
|
|
import com.viaversion.viaversion.api.Via;
|
2021-04-27 13:41:39 +02:00
|
|
|
import com.viaversion.viaversion.configuration.AbstractViaConfig;
|
2016-09-30 01:34:16 +02:00
|
|
|
import java.io.File;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.List;
|
2016-10-02 20:40:38 +02:00
|
|
|
import java.util.Map;
|
2023-02-12 11:44:25 +01:00
|
|
|
import org.bukkit.plugin.Plugin;
|
2016-09-30 01:34:16 +02:00
|
|
|
|
2019-05-15 12:22:56 +02:00
|
|
|
public class BukkitViaConfig extends AbstractViaConfig {
|
|
|
|
private static final List<String> UNSUPPORTED = Arrays.asList("bungee-ping-interval", "bungee-ping-save", "bungee-servers", "velocity-ping-interval", "velocity-ping-save", "velocity-servers");
|
2019-11-22 22:00:41 +01:00
|
|
|
private boolean antiXRay;
|
|
|
|
private boolean quickMoveActionFix;
|
|
|
|
private boolean hitboxFix1_9;
|
|
|
|
private boolean hitboxFix1_14;
|
2019-11-25 18:34:55 +01:00
|
|
|
private String blockConnectionMethod;
|
2023-02-03 17:02:22 +01:00
|
|
|
private boolean armorToggleFix;
|
2016-09-30 01:34:16 +02:00
|
|
|
|
2018-11-17 14:12:19 +01:00
|
|
|
public BukkitViaConfig() {
|
2019-11-22 22:00:41 +01:00
|
|
|
super(new File(((Plugin) Via.getPlatform()).getDataFolder(), "config.yml"));
|
2017-09-11 14:10:54 +02:00
|
|
|
reloadConfig();
|
2016-09-30 01:34:16 +02:00
|
|
|
}
|
|
|
|
|
2019-11-22 22:00:41 +01:00
|
|
|
@Override
|
|
|
|
protected void loadFields() {
|
|
|
|
super.loadFields();
|
|
|
|
antiXRay = getBoolean("anti-xray-patch", true);
|
|
|
|
quickMoveActionFix = getBoolean("quick-move-action-fix", false);
|
|
|
|
hitboxFix1_9 = getBoolean("change-1_9-hitbox", false);
|
|
|
|
hitboxFix1_14 = getBoolean("change-1_14-hitbox", false);
|
2019-11-25 18:34:55 +01:00
|
|
|
blockConnectionMethod = getString("blockconnection-method", "packet");
|
2023-02-03 17:02:22 +01:00
|
|
|
armorToggleFix = getBoolean("armor-toggle-fix", true);
|
2019-11-22 22:00:41 +01:00
|
|
|
}
|
|
|
|
|
2016-10-02 20:40:38 +02:00
|
|
|
@Override
|
|
|
|
protected void handleConfig(Map<String, Object> config) {
|
|
|
|
}
|
|
|
|
|
2019-11-22 22:00:41 +01:00
|
|
|
@Override
|
|
|
|
public boolean isAntiXRay() {
|
|
|
|
return antiXRay;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean is1_12QuickMoveActionFix() {
|
|
|
|
return quickMoveActionFix;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean is1_9HitboxFix() {
|
|
|
|
return hitboxFix1_9;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean is1_14HitboxFix() {
|
|
|
|
return hitboxFix1_14;
|
|
|
|
}
|
|
|
|
|
2019-11-25 18:34:55 +01:00
|
|
|
@Override
|
|
|
|
public String getBlockConnectionMethod() {
|
|
|
|
return blockConnectionMethod;
|
|
|
|
}
|
|
|
|
|
2023-02-03 17:02:22 +01:00
|
|
|
@Override
|
|
|
|
public boolean isArmorToggleFix() {
|
|
|
|
return armorToggleFix;
|
|
|
|
}
|
|
|
|
|
2016-09-30 01:34:16 +02:00
|
|
|
@Override
|
|
|
|
public List<String> getUnsupportedOptions() {
|
|
|
|
return UNSUPPORTED;
|
|
|
|
}
|
|
|
|
}
|