Skip to content
This repository has been archived by the owner on Feb 10, 2024. It is now read-only.

Commit

Permalink
Revert "Move to kotlin"
Browse files Browse the repository at this point in the history
This reverts commit b05d770.
  • Loading branch information
Window5 authored and Window5 committed Jan 19, 2023
1 parent b05d770 commit be39400
Show file tree
Hide file tree
Showing 36 changed files with 745 additions and 803 deletions.
2 changes: 1 addition & 1 deletion .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions .idea/codeStyles/Project.xml

This file was deleted.

5 changes: 0 additions & 5 deletions .idea/codeStyles/codeStyleConfig.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/kotlinc.xml

This file was deleted.

104 changes: 28 additions & 76 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 2 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ plugins {
id 'java'
id "com.github.johnrengelman.shadow" version "7.1.2"
id 'maven-publish'
id 'org.jetbrains.kotlin.jvm' version '1.8.0'
id "org.jetbrains.kotlin.plugin.lombok" version "1.8.0"
id "io.freefair.lombok" version "6.6.1"
}

Expand All @@ -23,36 +21,25 @@ dependencies {
implementation('net.kyori:adventure-text-minimessage:4.12.0')
implementation( "com.moandjiezana.toml:toml4j:0.7.2")
compileOnly("org.mongodb:mongo-java-driver:3.12.11")
compileOnly("org.projectlombok:lombok:1.18.24")
annotationProcessor("org.projectlombok:lombok:1.18.24")
}

kotlin {
jvmToolchain(17)
kotlinSourcesJar
}

publishing {
publications {
release(MavenPublication) {
afterEvaluate {
var shadowJar = tasks.findByName("shadowJar")
if (shadowJar == null) {
from(components["java"])
from(components["kotlin"])
}
if (shadowJar == null) from(components["java"])
else artifact(shadowJar)
}
groupId = 'com.github.HypeJet'
artifactId = 'HypeStom'
artifactId = 'HypeLib'
version = 'v2.0.0'
}
}
}

tasks.withType(ShadowJar) {
mergeServiceFiles()
archiveBaseName.set("HypeStom")
archiveClassifier.set("")
}

Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
rootProject.name = 'HypeStom'
rootProject.name = 'HypeLib'

63 changes: 63 additions & 0 deletions src/main/java/org/hypejet/hype/command/Command.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package org.hypejet.hype.command;

import org.hypejet.hype.permission.PermissionProvider;
import org.hypejet.hype.permission.SubPermission;
import net.minestom.server.command.CommandSender;
import net.minestom.server.command.ConsoleSender;
import net.minestom.server.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
* Normal Command witch also uses extra permission features.
*/
public class Command extends net.minestom.server.command.builder.Command {

/**
* The permission provider for this command
* @see SubPermission
*/
protected SubPermission provider;

/**
* Creates a new command.
* Default permissions the extension's permissions with the command name as a subpermission.
*
* @param provider PermissionsProvider, automatically set in the Extension class.
* @param name Name of the command SubPermission will be automatically created with this name.
* @param aliases Nullable, aliases to the command that the CommandSenders can also run to execute the command.
*<br>
* <br>
* See also:<br>
* {@link Command#setPermission(String)}
*/
public Command(@NotNull PermissionProvider provider, @NotNull String name, @Nullable String... aliases) {
super(name, aliases);
this.provider = new SubPermission(provider, name);
setPermission(name);
setCondition(this::defaultCondition);
}

/**
* Sets the subcommand permission.
* @param permission The permission to be used
*/
public void setPermission(String permission) {
provider.updatePermissions(permission);
}

/**
* Set the required permissions level required for bypassing permissions.
* @param level The new op level
*/
public void setPermissionLevel(int level) {
provider.setOpLevel(level);
}

/**
* Gives the sender access if it is either a console or if it has the command permission.
*/
protected boolean defaultCondition(CommandSender sender, String command) {
return sender instanceof ConsoleSender || provider.hasPermission((Player) sender);
}
}
Loading

0 comments on commit be39400

Please sign in to comment.