pRVNÍ commit

pull/6/head
jakub 1 year ago
commit b734d2352b
  1. 113
      .gitignore
  2. 72
      pom.xml
  3. 30
      src/main/java/xyz/soukup/mineconomiaCoreV2/MineconomiaCoreV2.java
  4. 15
      src/main/java/xyz/soukup/mineconomiaCoreV2/core/MsgRetriever.java
  5. 51
      src/main/java/xyz/soukup/mineconomiaCoreV2/core/PDC.java
  6. 12
      src/main/java/xyz/soukup/mineconomiaCoreV2/core/sharedValues.java
  7. 17
      src/main/java/xyz/soukup/mineconomiaCoreV2/tractor/giveTractorCommand.java
  8. 2
      src/main/resources/config.yml
  9. 6
      src/main/resources/lang/czech.yml
  10. 7
      src/main/resources/plugin.yml

113
.gitignore vendored

@ -0,0 +1,113 @@
# User-specific stuff
.idea/
*.iml
*.ipr
*.iws
# IntelliJ
out/
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
.flattened-pom.xml
# Common working directory
run/

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>xyz.soukup</groupId>
<artifactId>mineconomiacorev2</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>mineconomiacorev2</name>
<properties>
<java.version>21</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<defaultGoal>clean package</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.21.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

@ -0,0 +1,30 @@
package xyz.soukup.mineconomiaCoreV2;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
import xyz.soukup.mineconomiaCoreV2.tractor.giveTractorCommand;
import java.util.Objects;
public final class MineconomiaCoreV2 extends JavaPlugin {
MineconomiaCoreV2 plugin = getPlugin(this.getClass());
@Override
public void onEnable() {
// Plugin startup logic
getLogger().info("STARTING MINECONOMIA CORE");
plugin.saveConfig();
//tractor registration
Objects.requireNonNull(plugin.getCommand("tractor")).setExecutor(new giveTractorCommand());
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}

@ -0,0 +1,15 @@
package xyz.soukup.mineconomiaCoreV2.core;
import org.bukkit.configuration.file.YamlConfiguration;
import static xyz.soukup.mineconomiaCoreV2.core.sharedValues.config;
import static xyz.soukup.mineconomiaCoreV2.core.sharedValues.plugin;
public class MsgRetriever {
public static YamlConfiguration lang = null;
public static void loadLang(){
String langPath = "lang/" + config.getString("lang");
plugin.saveResource(langPath, false);
//lang = YamlConfiguration.loadConfiguration(plugin.getResource(langPath));
}
}

@ -0,0 +1,51 @@
package xyz.soukup.mineconomiaCoreV2.core;
import org.bukkit.NamespacedKey;
import org.bukkit.block.TileState;
import org.bukkit.entity.Player;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.persistence.PersistentDataType;
public class PDC {
public static void WritePlayerPDC(Player player, String key, PersistentDataType type, Object value){
NamespacedKey nKey = new NamespacedKey(sharedValues.plugin, key);
PersistentDataContainer pdc = player.getPersistentDataContainer();
pdc.set(nKey, type, value);
}
public static Object GetPlayerPDC(Player player, String key, PersistentDataType type){
NamespacedKey nKey = new NamespacedKey(sharedValues.plugin, key);
PersistentDataContainer pdc = player.getPersistentDataContainer();
return pdc.get(nKey, type);
}
public static void DeletePlayerPDC(Player player, String key){
NamespacedKey nKey = new NamespacedKey(sharedValues.plugin, key);
PersistentDataContainer pdc = player.getPersistentDataContainer();
pdc.remove(nKey);
}
public static void WriteItemMetaPDC(ItemMeta itemMeta, String key, PersistentDataType type, Object value){
NamespacedKey nKey = new NamespacedKey(sharedValues.plugin, key);
PersistentDataContainer pdc = itemMeta.getPersistentDataContainer();
pdc.set(nKey, type, value);
}
public static Object GetItemMetaPDC(ItemMeta itemMeta, String key, PersistentDataType type){
NamespacedKey nKey = new NamespacedKey(sharedValues.plugin, key);
PersistentDataContainer pdc = itemMeta.getPersistentDataContainer();
return pdc.get(nKey, type);
}
public static void WriteTileStatePDC(TileState tileState, String key, PersistentDataType type, Object value){
NamespacedKey nKey = new NamespacedKey(sharedValues.plugin, key);
PersistentDataContainer pdc = tileState.getPersistentDataContainer();
pdc.set(nKey, type, value);
}
public static Object GetTileStatePDC(TileState tileState, String key, PersistentDataType type){
NamespacedKey nKey = new NamespacedKey(sharedValues.plugin, key);
PersistentDataContainer pdc = tileState.getPersistentDataContainer();
return pdc.get(nKey, type);
}
}

@ -0,0 +1,12 @@
package xyz.soukup.mineconomiaCoreV2.core;
import org.bukkit.configuration.file.FileConfiguration;
import xyz.soukup.mineconomiaCoreV2.MineconomiaCoreV2;
import java.util.logging.Logger;
public class sharedValues {
public static MineconomiaCoreV2 plugin = MineconomiaCoreV2.getPlugin(MineconomiaCoreV2.class);
public static FileConfiguration config = plugin.getConfig();
public static Logger logger = plugin.getLogger();
}

@ -0,0 +1,17 @@
package xyz.soukup.mineconomiaCoreV2.tractor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class giveTractorCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {
if (!(commandSender instanceof Player)){
return false;
}
return false;
}
}

@ -0,0 +1,2 @@
version: 1.0
language: "czech.yml"

@ -0,0 +1,6 @@
error:
command:
not-player: "&cPříkaz může použít jen hráč!"
not-console: "&cPříkaz může použít jen konzole!"
wrong-argument-count: "&cNesprávný počet parametrů!"
no-permissions: "&cNemáš oprávnění!"

@ -0,0 +1,7 @@
name: MineconomiaCoreV2
version: '1.0-SNAPSHOT'
main: xyz.soukup.mineconomiaCoreV2.MineconomiaCoreV2
api-version: '1.21'
commands:
tractor:
description: "blieat"
Loading…
Cancel
Save