Dieser Commit ist enthalten in:
Ursprung
e3b5a5ab4d
Commit
16013fa7b1
@ -1,150 +1,149 @@
|
|||||||
/*
|
/*
|
||||||
This file is a part of the SteamWar software.
|
This file is a part of the SteamWar software.
|
||||||
|
|
||||||
Copyright (C) 2023 SteamWar.de-Serverteam
|
Copyright (C) 2023 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 GNU Affero General Public License as published by
|
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
|
the Free Software Foundation, either version 3 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 even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU 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. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package de.steamwar.schematicsystem.commands.schematiccommand;
|
package de.steamwar.schematicsystem.commands.schematiccommand;
|
||||||
|
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.*;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import de.steamwar.command.*;
|
import de.steamwar.command.*;
|
||||||
import de.steamwar.core.VersionDependent;
|
import de.steamwar.core.VersionDependent;
|
||||||
import de.steamwar.schematicsystem.CheckSchemType;
|
import de.steamwar.schematicsystem.CheckSchemType;
|
||||||
import de.steamwar.schematicsystem.SchematicSystem;
|
import de.steamwar.schematicsystem.SchematicSystem;
|
||||||
import de.steamwar.schematicsystem.autocheck.AutoCheckerResult;
|
import de.steamwar.schematicsystem.autocheck.AutoCheckerResult;
|
||||||
import de.steamwar.sql.*;
|
import de.steamwar.sql.*;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandHelp.*;
|
||||||
import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandHelp.*;
|
import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils.*;
|
||||||
import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils.*;
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@SuppressWarnings("unused")
|
public class SchematicCommand extends SWCommand {
|
||||||
public class SchematicCommand extends SWCommand {
|
|
||||||
|
public SchematicCommand() {
|
||||||
public SchematicCommand() {
|
super("schematic", new String[] {"schem", "/schem", "/schematic"});
|
||||||
super("schematic", Bukkit.getPluginManager().getPlugin("Teamserver") == null ? new String[] {"schem", "/schem", "/schematic"} : new String[]{"schem"});
|
}
|
||||||
}
|
|
||||||
|
@Register("help")
|
||||||
@Register("help")
|
public void pagedHelp(Player player, HelpPage page) {
|
||||||
public void pagedHelp(Player player, HelpPage page) {
|
printHelpPage(player, page);
|
||||||
printHelpPage(player, page);
|
}
|
||||||
}
|
|
||||||
|
@Register
|
||||||
@Register
|
public void genericHelp(Player player, String... args) {
|
||||||
public void genericHelp(Player player, String... args) {
|
printHelpMainPage(player);
|
||||||
printHelpMainPage(player);
|
}
|
||||||
}
|
|
||||||
|
@Register(value = "togglepublic", noTabComplete = true)
|
||||||
@Register(value = "togglepublic", noTabComplete = true)
|
public void togglePublicMode(Player player) {
|
||||||
public void togglePublicMode(Player player) {
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
if (!user.hasPerm(UserPerm.MODERATION)) {
|
||||||
if (!user.hasPerm(UserPerm.MODERATION)) {
|
genericHelp(player);
|
||||||
genericHelp(player);
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
if (togglePublic(player)) {
|
||||||
if (togglePublic(player)) {
|
SchematicSystem.MESSAGE.send("COMMAND_PUBLIC_ON", player);
|
||||||
SchematicSystem.MESSAGE.send("COMMAND_PUBLIC_ON", player);
|
} else {
|
||||||
} else {
|
SchematicSystem.MESSAGE.send("COMMAND_PUBLIC_OFF", player);
|
||||||
SchematicSystem.MESSAGE.send("COMMAND_PUBLIC_OFF", player);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Mapper("publicMapper")
|
||||||
@Mapper("publicMapper")
|
public TypeMapper<SchematicNode> publicNodeTypeMapper() {
|
||||||
public TypeMapper<SchematicNode> publicNodeTypeMapper() {
|
return SchematicMapper.publicNodeTypeMapper();
|
||||||
return SchematicMapper.publicNodeTypeMapper();
|
}
|
||||||
}
|
|
||||||
|
@Mapper("memberMapper")
|
||||||
@Mapper("memberMapper")
|
public static TypeMapper<NodeMember> nodeMemberTypeMapper() {
|
||||||
public static TypeMapper<NodeMember> nodeMemberTypeMapper() {
|
return SchematicMapper.nodeMemberTypeMapper();
|
||||||
return SchematicMapper.nodeMemberTypeMapper();
|
}
|
||||||
}
|
|
||||||
|
@Mapper("dirMapper")
|
||||||
@Mapper("dirMapper")
|
public static TypeMapper<SchematicNode> dirNodeTypeMapper() {
|
||||||
public static TypeMapper<SchematicNode> dirNodeTypeMapper() {
|
return SchematicMapper.dirNodeTypeMapper();
|
||||||
return SchematicMapper.dirNodeTypeMapper();
|
}
|
||||||
}
|
|
||||||
|
@Mapper("publicDirMapper")
|
||||||
@Mapper("publicDirMapper")
|
public static TypeMapper<SchematicNode> publicDirNodeTypeMapper() {
|
||||||
public static TypeMapper<SchematicNode> publicDirNodeTypeMapper() {
|
return SchematicMapper.publicDirNodeTypeMapper();
|
||||||
return SchematicMapper.publicDirNodeTypeMapper();
|
}
|
||||||
}
|
|
||||||
|
@Mapper("dirStringMapper")
|
||||||
@Mapper("dirStringMapper")
|
public static TypeMapper<String> stringTabMapper() {
|
||||||
public static TypeMapper<String> stringTabMapper() {
|
return SchematicMapper.stringTabMapper();
|
||||||
return SchematicMapper.stringTabMapper();
|
}
|
||||||
}
|
|
||||||
|
@Mapper("stringMapper")
|
||||||
@Mapper("stringMapper")
|
public static TypeMapper<String> stringMapper() {
|
||||||
public static TypeMapper<String> stringMapper() {
|
return SchematicMapper.stringMapper();
|
||||||
return SchematicMapper.stringMapper();
|
}
|
||||||
}
|
|
||||||
|
@ClassMapper(SchematicType.class)
|
||||||
@ClassMapper(SchematicType.class)
|
public static TypeMapper<SchematicType> typeTypeMapper() {
|
||||||
public static TypeMapper<SchematicType> typeTypeMapper() {
|
return SchematicMapper.typeTypeMapper();
|
||||||
return SchematicMapper.typeTypeMapper();
|
}
|
||||||
}
|
|
||||||
|
@AbstractSWCommand.ClassMapper(value = SchematicNode.class, local = true)
|
||||||
@AbstractSWCommand.ClassMapper(value = SchematicNode.class, local = true)
|
public static TypeMapper<SchematicNode> nodeTypeMapper() {
|
||||||
public static TypeMapper<SchematicNode> nodeTypeMapper() {
|
return SchematicMapper.nodeTypeMapper();
|
||||||
return SchematicMapper.nodeTypeMapper();
|
}
|
||||||
}
|
|
||||||
|
@ClassMapper(value = CheckSchemType.class, local = true)
|
||||||
@ClassMapper(value = CheckSchemType.class, local = true)
|
public static TypeMapper<CheckSchemType> checkSchemTypeTypeMapper() {
|
||||||
public static TypeMapper<CheckSchemType> checkSchemTypeTypeMapper() {
|
return SchematicMapper.checkSchemTypeTypeMapper();
|
||||||
return SchematicMapper.checkSchemTypeTypeMapper();
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
@Override
|
protected void sendMessage(CommandSender sender, String message, Object[] args) {
|
||||||
protected void sendMessage(CommandSender sender, String message, Object[] args) {
|
SchematicSystem.MESSAGE.send(message, sender, args);
|
||||||
SchematicSystem.MESSAGE.send(message, sender, args);
|
}
|
||||||
}
|
|
||||||
|
@Validator(value = "isSchemValidator", local = true)
|
||||||
@Validator(value = "isSchemValidator", local = true)
|
public static TypeValidator<SchematicNode> isSchemValidator() {
|
||||||
public static TypeValidator<SchematicNode> isSchemValidator() {
|
return SchematicValidator.isSchemValidator();
|
||||||
return SchematicValidator.isSchemValidator();
|
}
|
||||||
}
|
|
||||||
|
@Validator(value = "isDirValidator", local = true)
|
||||||
@Validator(value = "isDirValidator", local = true)
|
public static TypeValidator<SchematicNode> isDirValidator() {
|
||||||
public static TypeValidator<SchematicNode> isDirValidator() {
|
return SchematicValidator.isDirValidator();
|
||||||
return SchematicValidator.isDirValidator();
|
}
|
||||||
}
|
|
||||||
|
@Validator(value = "isOwnerValidator", local = true)
|
||||||
@Validator(value = "isOwnerValidator", local = true)
|
public static TypeValidator<SchematicNode> isOwnerValidator() {
|
||||||
public static TypeValidator<SchematicNode> isOwnerValidator() {
|
return SchematicValidator.isOwnerValidator();
|
||||||
return SchematicValidator.isOwnerValidator();
|
}
|
||||||
}
|
|
||||||
|
@Validator(value = "isOwnerSchematicValidator", local = true)
|
||||||
@Validator(value = "isOwnerSchematicValidator", local = true)
|
public static TypeValidator<SchematicNode> isOwnerSchematicValidator() {
|
||||||
public static TypeValidator<SchematicNode> isOwnerSchematicValidator() {
|
return SchematicValidator.isOwnerSchematicValidator();
|
||||||
return SchematicValidator.isOwnerSchematicValidator();
|
}
|
||||||
}
|
|
||||||
|
public enum Extend {
|
||||||
public enum Extend {
|
AUSFAHREN,
|
||||||
AUSFAHREN,
|
NORMAL
|
||||||
NORMAL
|
}
|
||||||
}
|
|
||||||
|
public static final ISchematicCommand impl = VersionDependent.getVersionImpl(SchematicSystem.getInstance());
|
||||||
public static final ISchematicCommand impl = VersionDependent.getVersionImpl(SchematicSystem.getInstance());
|
|
||||||
|
public interface ISchematicCommand {
|
||||||
public interface ISchematicCommand {
|
Clipboard fixClipboard(Clipboard clipboard, AutoCheckerResult result, CheckSchemType type) throws Exception;
|
||||||
Clipboard fixClipboard(Clipboard clipboard, AutoCheckerResult result, CheckSchemType type) throws Exception;
|
void createCopy(EditSession editSession, Clipboard clipboard) throws WorldEditException;
|
||||||
void createCopy(EditSession editSession, Clipboard clipboard) throws WorldEditException;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren